Added tests to makefile.
This commit is contained in:
parent
8cdfb9fedb
commit
0aaf6a24c9
13
c/Makefile
13
c/Makefile
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
all: build static-lib dynamic-lib example
|
all: build static-lib dynamic-lib example compile-tests
|
||||||
|
|
||||||
build:
|
build:
|
||||||
gcc -c -g cmdlineoptions.c
|
gcc -c -g cmdlineoptions.c
|
||||||
|
@ -20,4 +20,13 @@ clean:
|
||||||
|
|
||||||
example:
|
example:
|
||||||
gcc -I. -g example.c -o example-shared -L. -lcmdlineoptions
|
gcc -I. -g example.c -o example-shared -L. -lcmdlineoptions
|
||||||
gcc -g example.c -o example-static libcmdlineoptions.a
|
gcc -g example.c -o example-static libcmdlineoptions.a
|
||||||
|
|
||||||
|
|
||||||
|
compile-tests:
|
||||||
|
gcc -I. -g tests.c -o tests-shared -L. -lcmdlineoptions
|
||||||
|
gcc tests.c -o tests-static libcmdlineoptions.a
|
||||||
|
|
||||||
|
test:
|
||||||
|
LD_LIBRARY_PATH="." tests-shared
|
||||||
|
tests-static
|
19
c/tests.c
19
c/tests.c
|
@ -23,7 +23,26 @@ void configureDefaultSet(){
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
// configure the options
|
||||||
|
configureDefaultSet();
|
||||||
|
|
||||||
|
// emulate parameters
|
||||||
|
int myargc = 0;
|
||||||
|
char** myargv = 0;
|
||||||
|
|
||||||
|
// test 1 parse nothing.
|
||||||
|
CmdLO_Parse(myargc,myargv);
|
||||||
|
|
||||||
|
// check contents...
|
||||||
|
|
||||||
|
|
||||||
|
// test 2 parse everything
|
||||||
|
|
||||||
|
|
||||||
|
// test 3 parse something
|
||||||
|
|
||||||
|
|
||||||
|
// test 4 producing some errors...
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue