You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2016/03/20 06:54:01 UTC

[07/14] lucy-clownfish git commit: Add UINT_EQ to CFC tests.

Add UINT_EQ to 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/9d3aef80
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9d3aef80
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9d3aef80

Branch: refs/heads/master
Commit: 9d3aef8012cba02f43cb5cf17cefbebb8a9814a8
Parents: 74b7a06
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Mar 19 22:27:49 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 compiler/src/CFCTest.c | 17 +++++++++++++++++
 compiler/src/CFCTest.h | 11 +++++++++++
 2 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9d3aef80/compiler/src/CFCTest.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c
index 3e8cd41..f925cb1 100644
--- a/compiler/src/CFCTest.c
+++ b/compiler/src/CFCTest.c
@@ -288,6 +288,23 @@ CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
 }
 
 void
+CFCTest_test_uint_equals(CFCTest *self, uint64_t result, uint64_t expected,
+                        const char *fmt, ...) {
+    int cond = (result == expected);
+
+    va_list args;
+    va_start(args, fmt);
+    S_vtest_true(self, cond, fmt, args);
+    va_end(args);
+
+    if (!cond) {
+        self->formatter->test_comment("Expected '%"PRIu64"',"
+                                      " got '%"PRIu64"'.\n",
+                                      expected, result);
+    }
+}
+
+void
 CFCTest_skip(CFCTest *self, int num, const char *fmt, ...) {
     va_list args;
     va_start(args, fmt);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9d3aef80/compiler/src/CFCTest.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h
index a88418a..352e390 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 UINT_EQ CFCTest_test_uint_equals
   #define SKIP    CFCTest_skip
 #endif
 
@@ -113,6 +114,16 @@ void
 CFCTest_test_int_equals(CFCTest *self, int64_t result, int64_t expected,
                         const char *fmt, ...);
 
+/* Test unsigned integers for equality and collect result.
+ *
+ * @param result Result integer to be tested.
+ * @param expected Expected result integer.
+ * @param fmt printf-like format string describing the test.
+ */
+void
+CFCTest_test_uint_equals(CFCTest *self, uint64_t result, uint64_t expected,
+                         const char *fmt, ...);
+
 /* Skip tests.
  *
  * @param num Number of tests to skip.