]> git.mdlowis.com Git - archive/carl.git/commitdiff
Optimized unicode data test
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 11 Dec 2015 00:52:24 +0000 (19:52 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 11 Dec 2015 00:52:24 +0000 (19:52 -0500)
tests/utf/test_rune.c [new file with mode: 0644]
tests/utf/test_unicodedata.c

diff --git a/tests/utf/test_rune.c b/tests/utf/test_rune.c
new file mode 100644 (file)
index 0000000..5fb959d
--- /dev/null
@@ -0,0 +1,20 @@
+// Unit Test Framework Includes
+#include "atf.h"
+
+// File To Test
+#include <carl.h>
+
+//-----------------------------------------------------------------------------
+// Begin Unit Tests
+//-----------------------------------------------------------------------------
+TEST_SUITE(RuneFns) {
+    TEST(Verify runecmp returns -1 when b is less than a) {
+        CHECK(-1 == runecmp('a','b'));
+    }
+
+    TEST(Verify runecmp returns 1 when a is less than b) {
+    }
+
+    TEST(Verify runecmp returns 0 when two runes are equal) {
+    }
+}
index a888e712fc65819cb0a5fe1253a2b21aacc730bc..17f9c892b4b76512fa45a0cdec47dfb1f8ca4972 100644 (file)
@@ -126,25 +126,25 @@ void free_codepoint(codept_t* cp) {
 // Begin Unit Tests
 //-----------------------------------------------------------------------------
 TEST_SUITE(UnicodeData) {
-    TEST(Verify_runetype_functions) {
+    TEST(Verify_generated_rune_functions) {
         codept_t cp;
         FILE* db = fopen(database, "r");
         while(read_codepoint(&cp, db)) {
             isrune_fn_t* fns = lookup_codepoint(&cp);
+            /* Verify the type functions work as expected */
             while(fns && *fns) {
-                /* Verify the type function works as expected */
                 CHECK((*fns)(cp.value));
-                /* Verify toupper works if necessary */
-                if (cp.toupper > 0)
-                    CHECK( cp.toupper == toupperrune(cp.value) );
-                /* Verify tolower works if necessary */
-                if (cp.tolower > 0)
-                    CHECK( cp.tolower == tolowerrune(cp.value) );
-                /* Verify toupper works if necessary */
-                if (cp.totitle > 0)
-                    CHECK( cp.totitle == totitlerune(cp.value) );
                 fns++;
             }
+            /* Verify toupper works if necessary */
+            if (cp.toupper > 0)
+                CHECK( cp.toupper == toupperrune(cp.value) );
+            /* Verify tolower works if necessary */
+            if (cp.tolower > 0)
+                CHECK( cp.tolower == tolowerrune(cp.value) );
+            /* Verify toupper works if necessary */
+            if (cp.totitle > 0)
+                CHECK( cp.totitle == totitlerune(cp.value) );
             free_codepoint(&cp);
         }
         fclose(db);