lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [04/12] lucy-clownfish git commit: Finish support for skipping CFC tests
Date Thu, 10 Mar 2016 13:35:21 GMT
Finish support for skipping CFC tests


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/6fdf098c
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/6fdf098c
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/6fdf098c

Branch: refs/heads/master
Commit: 6fdf098cef2a360218df6fc666e52d9af5b87152
Parents: ce0dfbb
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Mar 5 18:09:27 2016 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sat Mar 5 18:14:35 2016 +0100

----------------------------------------------------------------------
 compiler/src/CFCTest.c | 37 ++++++++++++++++++++++++++++++++++++-
 compiler/src/CFCTest.h |  3 ++-
 2 files changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6fdf098c/compiler/src/CFCTest.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c
index c62f3b5..0f61745 100644
--- a/compiler/src/CFCTest.c
+++ b/compiler/src/CFCTest.c
@@ -37,6 +37,7 @@ typedef struct CFCTestFormatter {
                          va_list args);
     void (*test_comment)(const char *fmt, ...);
     void (*batch_comment)(const char *fmt, ...);
+    void (*skip)(int test_num, int num_skipped, const char *fmt, va_list args);
     void (*summary)(const CFCTest *test);
 } CFCTestFormatter;
 
@@ -71,6 +72,10 @@ static void
 S_format_cfish_batch_comment(const char *fmt, ...);
 
 static void
+S_format_cfish_skip(int test_num, int num_skipped, const char *fmt,
+                    va_list args);
+
+static void
 S_format_cfish_summary(const CFCTest *test);
 
 static void
@@ -87,6 +92,10 @@ static void
 S_format_tap_batch_comment(const char *fmt, ...);
 
 static void
+S_format_tap_skip(int test_num, int num_skipped, const char *fmt,
+                  va_list args);
+
+static void
 S_format_tap_summary(const CFCTest *test);
 
 static const CFCMeta CFCTEST_META = {
@@ -100,6 +109,7 @@ static const CFCTestFormatter S_formatter_cfish = {
     S_format_cfish_vtest_result,
     S_format_cfish_test_comment,
     S_format_cfish_batch_comment,
+    S_format_cfish_skip,
     S_format_cfish_summary
 };
 
@@ -108,6 +118,7 @@ static const CFCTestFormatter S_formatter_tap = {
     S_format_tap_vtest_result,
     S_format_tap_test_comment,
     S_format_tap_batch_comment,
+    S_format_tap_skip,
     S_format_tap_summary
 };
 
@@ -261,7 +272,12 @@ CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
 }
 
 void
-CFCTest_skip(CFCTest *self, int num) {
+CFCTest_skip(CFCTest *self, int num, const char *fmt, ...) {
+    va_list args;
+    va_start(args, fmt);
+    self->formatter->skip(self->num_tests + 1, num, fmt, args);
+    va_end(args);
+
     self->num_tests          += num;
     self->num_tests_in_batch += num;
 }
@@ -327,6 +343,15 @@ S_format_cfish_batch_comment(const char *fmt, ...) {
 }
 
 static void
+S_format_cfish_skip(int test_num, int num_skipped, const char *fmt,
+                    va_list args) {
+    CHY_UNUSED_VAR(test_num);
+    CHY_UNUSED_VAR(num_skipped);
+    CHY_UNUSED_VAR(fmt);
+    CHY_UNUSED_VAR(args);
+}
+
+static void
 S_format_cfish_summary(const CFCTest *test) {
     if (test->num_batches == 0) {
         printf("No tests planned or run.\n");
@@ -379,6 +404,16 @@ S_format_tap_batch_comment(const char *fmt, ...) {
 }
 
 static void
+S_format_tap_skip(int test_num, int num_skipped, const char *fmt,
+                  va_list args) {
+    for (int i = 0; i < num_skipped; ++i) {
+        printf("ok %d # SKIP ", test_num + i);
+        vprintf(fmt, args);
+        printf("\n");
+    }
+}
+
+static void
 S_format_tap_summary(const CFCTest *test) {
     (void)test; // unused
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6fdf098c/compiler/src/CFCTest.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h
index 93d11eb..41cf73d 100644
--- a/compiler/src/CFCTest.h
+++ b/compiler/src/CFCTest.h
@@ -29,6 +29,7 @@
   #define OK      CFCTest_test_true
   #define STR_EQ  CFCTest_test_string_equals
   #define INT_EQ  CFCTest_test_int_equals
+  #define SKIP    CFCTest_skip
 #endif
 
 typedef struct CFCTest CFCTest;
@@ -112,7 +113,7 @@ CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected,
  * @param num Number of tests to skip.
  */
 void
-CFCTest_skip(CFCTest *self, int num);
+CFCTest_skip(CFCTest *self, int num, const char *fmt, ...);
 
 /* Finish testing.
  *


Mime
View raw message