public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] path-sandbox r412 - in trunk: . tests
@ 2008-11-16  5:32 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2008-11-16  5:32 UTC (permalink / raw
  To: gentoo-commits

Author: vapier
Date: 2008-11-16 05:32:35 +0000 (Sun, 16 Nov 2008)
New Revision: 412

Added:
   trunk/tests/sb_printf_tst.c
Modified:
   trunk/configure.ac
   trunk/tests/
   trunk/tests/Makefile.am
Log:
add tests for sb_printf()

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-11-16 05:31:35 UTC (rev 411)
+++ trunk/configure.ac	2008-11-16 05:32:35 UTC (rev 412)
@@ -5,6 +5,7 @@
 
 dnl Checks for programs.
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_ISC_POSIX
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET


Property changes on: trunk/tests
___________________________________________________________________
Name: svn:ignore
   - .deps
atconfig
Makefile
Makefile.in
package.m4
testsuite
testsuite.dir
testsuite.log
*-0

   + .deps
atconfig
Makefile
Makefile.in
package.m4
testsuite
testsuite.dir
testsuite.log
*-0
*_tst


Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am	2008-11-16 05:31:35 UTC (rev 411)
+++ trunk/tests/Makefile.am	2008-11-16 05:32:35 UTC (rev 412)
@@ -40,8 +40,13 @@
 	unlinkat-0 \
 	utime-0 \
 	utimensat-0 \
-	utimes-0
+	utimes-0 \
+	\
+	sb_printf_tst
 
+sb_printf_tst_CFLAGS = -I$(top_srcdir)/libsbutil -I$(top_srcdir)/libsbutil/include
+sb_printf_tst_LDADD = $(top_builddir)/libsbutil/libsbutil.la
+
 check-local: atconfig atlocal $(TESTSUITE)
 	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
 

Added: trunk/tests/sb_printf_tst.c
===================================================================
--- trunk/tests/sb_printf_tst.c	                        (rev 0)
+++ trunk/tests/sb_printf_tst.c	2008-11-16 05:32:35 UTC (rev 412)
@@ -0,0 +1,45 @@
+#include "headers.h"
+#include "sbutil.h"
+
+#define T(fmt, args...) \
+	do { \
+		printf(fmt "\n", ##args); \
+		sb_printf(fmt "\n", ##args); \
+	} while (0)
+
+int main(int argc, char *argv[])
+{
+	T("%i", argc);
+	T("%i", -argc);
+	T("%d", 123);
+	T("%d", -123);
+	T("%u", 1000);
+	T("%zi", argc);
+	T("%zi", -argc);
+	T("%zd", 123);
+	T("%zd", -123);
+	T("%zu", 1000);
+
+	T("%x", argc);
+	T("%x", 0xabcdef);
+	T("%X", argc);
+	T("%X", 0xabcdef);
+
+	T("%c", 'a');
+	T("%c", '0');
+	T("%c", 'K');
+	T("%s", "wOOf");
+	T("%s", "CoW");
+	T("%s", "!HI!");
+
+	size_t i;
+	for (i = 0; i < 6; ++i)
+		T("%s%*s%s", "{pre}", i, "cow", "{post}");
+
+	T("%%");
+
+	void *moo = (void *)0x123456;
+	T("%p", moo);
+
+	return 0;
+}




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-16  5:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-16  5:32 [gentoo-commits] path-sandbox r412 - in trunk: . tests Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox