lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [06/14] lucy-clownfish git commit: Add UINT_EQ test functions.
Date Sun, 20 Mar 2016 05:54:00 GMT
Add UINT_EQ test functions.

Add unsigned integer unit test functions.


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

Branch: refs/heads/master
Commit: e37b154b20984708dc533d4060cbaed7eca1a49c
Parents: b5a1dd2
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Sat Mar 19 21:59:44 2016 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Mar 19 22:34:21 2016 -0700

----------------------------------------------------------------------
 .../Clownfish/TestHarness/TestBatchRunner.c     | 25 ++++++++++++++++++++
 .../Clownfish/TestHarness/TestBatchRunner.cfh   |  9 +++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e37b154b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
index df95034..fd3bec9 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c
@@ -161,6 +161,17 @@ TestBatchRunner_test_int_equals(TestBatchRunner *self, int64_t got,
 }
 
 bool
+TestBatchRunner_test_uint_equals(TestBatchRunner *self, uint64_t got,
+                                 uint64_t expected, const char *pattern, ...) {
+    va_list args;
+    va_start(args, pattern);
+    bool result = TestBatchRunner_VTest_UInt_Equals(self, got, expected,
+                                                    pattern, args);
+    va_end(args);
+    return result;
+}
+
+bool
 TestBatchRunner_test_float_equals(TestBatchRunner *self, double got,
                                   double expected, const char *pattern, ...) {
     va_list args;
@@ -230,6 +241,20 @@ TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, int64_t got,
     S_vtest_true(self, pass, pattern, args);
     if (!pass) {
         TestFormatter_test_comment(self->formatter,
+                                   "Expected '%"PRId64"', got '%"PRId64"'.\n",
+                                   expected, got);
+    }
+    return pass;
+}
+
+bool
+TestBatchRunner_VTest_UInt_Equals_IMP(TestBatchRunner *self, uint64_t got,
+                                      uint64_t expected, const char *pattern,
+                                      va_list args) {
+    bool pass = (got == expected);
+    S_vtest_true(self, pass, pattern, args);
+    if (!pass) {
+        TestFormatter_test_comment(self->formatter,
                                    "Expected '%"PRIu64"', got '%"PRIu64"'.\n",
                                    expected, got);
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e37b154b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
index 85bec44..0f01b38 100644
--- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
+++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh
@@ -72,6 +72,10 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj {
                     const char *pattern, ...);
 
     inert bool
+    test_uint_equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+                     const char *pattern, ...);
+
+    inert bool
     test_float_equals(TestBatchRunner *self, double got, double expected,
                       const char *pattern, ...);
 
@@ -101,6 +105,10 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj
{
                      const char *pattern, va_list args);
 
     bool
+    VTest_UInt_Equals(TestBatchRunner *self, uint64_t got, uint64_t expected,
+                     const char *pattern, va_list args);
+
+    bool
     VTest_Float_Equals(TestBatchRunner *self, double got, double expected,
                        const char *pattern, va_list args);
 
@@ -125,6 +133,7 @@ __C__
   #define TEST_TRUE            cfish_TestBatchRunner_test_true
   #define TEST_FALSE           cfish_TestBatchRunner_test_false
   #define TEST_INT_EQ          cfish_TestBatchRunner_test_int_equals
+  #define TEST_UINT_EQ         cfish_TestBatchRunner_test_uint_equals
   #define TEST_FLOAT_EQ        cfish_TestBatchRunner_test_float_equals
   #define TEST_STR_EQ          cfish_TestBatchRunner_test_string_equals
   #define PASS                 cfish_TestBatchRunner_pass


Mime
View raw message