diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-12 21:11:57 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-12 21:11:57 +0200 |
commit | 0a1c5c69244b1199cb877aed029a3c9aca68f60a (patch) | |
tree | ed68f775060b0fc1f27830847272c1f7d5ff7ad3 /tests | |
parent | 3adae629e98f9fd256349b291e89e6f63c5e469e (diff) | |
download | abaos-0a1c5c69244b1199cb877aed029a3c9aca68f60a.tar.gz abaos-0a1c5c69244b1199cb877aed029a3c9aca68f60a.tar.bz2 |
added a itoa
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 16 | ||||
-rw-r--r-- | tests/test_itoa.c | 13 |
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/Makefile b/tests/Makefile index af20182..6b91c9b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,19 +5,27 @@ LD := ld all: test -test_strlcpy: test_strlcpy.o - test_strlcpy: test_strlcpy.o ../src/string.o $(CC) -o test_strlcpy test_strlcpy.o ../src/string.o test_strlcpy.o: test_strlcpy.c $(CC) $(CFLAGS) $(INCLUDES) -c -o test_strlcpy.o test_strlcpy.c +test_itoa: test_itoa.o ../src/stdlib.o ../src/string.o + $(CC) -o test_itoa test_itoa.o ../src/stdlib.o ../src/string.o + +test_itoa.o: test_itoa.c ../src/stdlib.o + $(CC) $(CFLAGS) $(INCLUDES) -c -o test_itoa.o test_itoa.c + ../src/string.o: ../src/string.c $(CC) $(CFLAGS) -c -o ../src/string.o ../src/string.c -test: test_strlcpy +../src/stdlib.o: ../src/stdlib.c + $(CC) $(CFLAGS) -c -o ../src/stdlib.o ../src/stdlib.c + +test: test_strlcpy test_itoa ./test_strlcpy + ./test_itoa clean: - -rm -f test_strlcpy *.o + -rm -f test_strlcpy test_itoa *.o diff --git a/tests/test_itoa.c b/tests/test_itoa.c new file mode 100644 index 0000000..76df145 --- /dev/null +++ b/tests/test_itoa.c @@ -0,0 +1,13 @@ +#include "stdlib.h" +#include "string.h" + +int main( void ) +{ + char *res; + char buf[11]; + + res = itoa( 568876, buf, 10 ); + if( strcmp( res, buf ) ) return 1; + + return 0; +} |