From 69f1f6526a6d40556ed3dcb50cdc199f45793b2f Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Mon, 1 Mar 2010 17:45:47 -0500 Subject: [PATCH] move snprintf test suite to tests/snprintf/ and add test --- configure.ac | 1 + snprintf/Makefile.am | 5 ----- tests/Makefile.am | 2 +- tests/snprintf/Makefile.am | 5 +++++ {snprintf => tests/snprintf}/prog.c | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 tests/snprintf/Makefile.am rename {snprintf => tests/snprintf}/prog.c (62%) diff --git a/configure.ac b/configure.ac index 64a708ad..c2728f76 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/snprintf/Makefile.am b/snprintf/Makefile.am index 04148b71..5ef7d826 100644 --- a/snprintf/Makefile.am +++ b/snprintf/Makefile.am @@ -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/tests/Makefile.am b/tests/Makefile.am index 2ddaceba..abe446e2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..809531b1 --- /dev/null +++ b/tests/snprintf/Makefile.am @@ -0,0 +1,5 @@ +check_PROGRAMS = prog +prog_SOURCES = prog.c +prog_LDADD = $(top_builddir)/snprintf/libustsnprintf.la + +TESTS = prog diff --git a/snprintf/prog.c b/tests/snprintf/prog.c similarity index 62% rename from snprintf/prog.c rename to tests/snprintf/prog.c index 157511ba..c6116fe3 100644 --- a/snprintf/prog.c +++ b/tests/snprintf/prog.c @@ -7,8 +7,8 @@ int main() char *expected; - expected = "header 9999, hello, 003"; - ust_safe_snprintf(buf, 99, "header %d, %s, %03d", 9999, "hello", 3); + 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; -- 2.34.1