move snprintf test suite to tests/snprintf/ and add test
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Mon, 1 Mar 2010 22:45:47 +0000 (17:45 -0500)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Mon, 1 Mar 2010 22:45:47 +0000 (17:45 -0500)
configure.ac
snprintf/Makefile.am
snprintf/prog.c [deleted file]
tests/Makefile.am
tests/snprintf/Makefile.am [new file with mode: 0644]
tests/snprintf/prog.c [new file with mode: 0644]

index 64a708adf1e6268b7c20d5526cba8970083882c3..c2728f7667b9303ff3270c14d4ebe5c4b9e2f58f 100644 (file)
@@ -118,6 +118,7 @@ AC_CONFIG_FILES([
        tests/basic_long/Makefile
        tests/fork/Makefile
        tests/simple_include/Makefile
+       tests/snprintf/Makefile
        libmallocwrap/Makefile
        libinterfork/Makefile
        ustd/Makefile
index 04148b71aeece6b46b0d1a4312d86ee894567710..5ef7d82697f1e5085400a6298f1d8dd592f7d488 100644 (file)
@@ -16,8 +16,3 @@ libustsnprintf_la_SOURCES = \
        wsetup.c
 libustsnprintf_la_LDFLAGS = -no-undefined -version-info 0:0:0 -static
 libustsnprintf_la_CFLAGS = -DUST_COMPONENT="ust_snprintf" -fPIC
-
-check_PROGRAMS = prog
-prog_SOURCES = prog.c
-prog_LDADD = libustsnprintf.la
-TESTS = prog
diff --git a/snprintf/prog.c b/snprintf/prog.c
deleted file mode 100644 (file)
index 157511b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-int main()
-{
-       char buf[100];
-
-       char *expected;
-
-       expected = "header 9999, hello, 003";
-       ust_safe_snprintf(buf, 99, "header %d, %s, %03d", 9999, "hello", 3);
-       if(strcmp(buf, expected) != 0) {
-               printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf);
-               return 1;
-       }
-
-       return 0;
-}
index 2ddaceba3173d672013461dd49984fe835bf8ead..abe446e2d9aaf81000271388cbdb34cfdf92df03 100644 (file)
@@ -1 +1 @@
-SUBDIRS = hello hello2 basic basic_long fork simple_include
+SUBDIRS = hello hello2 basic basic_long fork simple_include snprintf
diff --git a/tests/snprintf/Makefile.am b/tests/snprintf/Makefile.am
new file mode 100644 (file)
index 0000000..809531b
--- /dev/null
@@ -0,0 +1,5 @@
+check_PROGRAMS = prog
+prog_SOURCES = prog.c
+prog_LDADD = $(top_builddir)/snprintf/libustsnprintf.la
+
+TESTS = prog
diff --git a/tests/snprintf/prog.c b/tests/snprintf/prog.c
new file mode 100644 (file)
index 0000000..c6116fe
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+       char buf[100];
+
+       char *expected;
+
+       expected = "header 9999, hello, 005, '    9'";
+       ust_safe_snprintf(buf, 99, "header %d, %s, %03d, '%3$*d'", 9999, "hello", 5, 9);
+       if(strcmp(buf, expected) != 0) {
+               printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf);
+               return 1;
+       }
+
+       return 0;
+}
This page took 0.026303 seconds and 4 git commands to generate.