INN commit: trunk/tests (libtest.c libtest.h)

INN Commit rra at isc.org
Thu Aug 18 14:12:08 UTC 2011


    Date: Thursday, August 18, 2011 @ 07:12:08
  Author: iulius
Revision: 9349

fix the libtest support files to make the new libtest format work

Modified:
  trunk/tests/libtest.c
  trunk/tests/libtest.h

-----------+
 libtest.c |   32 ++++++++------------------------
 libtest.h |    4 ++++
 2 files changed, 12 insertions(+), 24 deletions(-)

Modified: libtest.c
===================================================================
--- libtest.c	2011-08-18 14:10:05 UTC (rev 9348)
+++ libtest.c	2011-08-18 14:12:08 UTC (rev 9349)
@@ -198,18 +198,14 @@
  * Takes a boolean success value and assumes the test passes if that value
  * is true and fails if that value is false.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-ok(int success, const char *format, ...)
-#else
-void
 ok(int n UNUSED, int success) {
     new_ok(success, NULL);
 }
-
+#endif
 void
 new_ok(int success, const char *format, ...)
-#endif
 {
     fflush(stderr);
     printf("%sok %lu", success ? "" : "not ", testnum++);
@@ -245,18 +241,14 @@
 /*
  * Skip a test.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-skip(const char *reason, ...)
-#else
-void
 skip(int n UNUSED, const char *reason) {
     new_skip(reason);
 }
-
+#endif
 void
 new_skip(const char *reason, ...)
-#endif
 {
     fflush(stderr);
     printf("ok %lu # skip", testnum++);
@@ -275,18 +267,14 @@
 /*
  * Report the same status on the next count tests.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-ok_block(unsigned long count, int status, const char *format, ...)
-#else
-void
 ok_block(int n UNUSED, int count, int success) {
     new_ok_block(count, success, NULL);
 }
-
+#endif
 void
 new_ok_block(unsigned long count, int status, const char *format, ...)
-#endif
 {
     unsigned long i;
 
@@ -310,18 +298,14 @@
 /*
  * Skip the next count tests.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-skip_block(unsigned long count, const char *reason, ...)
-#else
-void
 skip_block(int n UNUSED, int count, const char *reason) {
     new_skip_block(count, reason);
 }
-
+#endif
 void
 new_skip_block(unsigned long count, const char *reason, ...)
-#endif
 {
     unsigned long i;
 

Modified: libtest.h
===================================================================
--- libtest.h	2011-08-18 14:10:05 UTC (rev 9348)
+++ libtest.h	2011-08-18 14:12:08 UTC (rev 9349)
@@ -123,6 +123,10 @@
 void errors_capture(void);
 void errors_uncapture(void);
 #else
+# define ok new_ok
+# define skip new_skip
+# define ok_block new_ok_block
+# define skip_block new_skip_block
 void ok(int success, const char *format, ...)
     __attribute__((__format__(printf, 2, 3)));
 void skip(const char *reason, ...)




More information about the inn-committers mailing list