From: Michael D. Lowis Date: Fri, 11 Dec 2015 00:52:24 +0000 (-0500) Subject: Optimized unicode data test X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=6b7f5178e50ffbfa645676afdd09cf15d777314e;p=archive%2Fcarl.git Optimized unicode data test --- diff --git a/tests/utf/test_rune.c b/tests/utf/test_rune.c new file mode 100644 index 0000000..5fb959d --- /dev/null +++ b/tests/utf/test_rune.c @@ -0,0 +1,20 @@ +// Unit Test Framework Includes +#include "atf.h" + +// File To Test +#include + +//----------------------------------------------------------------------------- +// 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) { + } +} diff --git a/tests/utf/test_unicodedata.c b/tests/utf/test_unicodedata.c index a888e71..17f9c89 100644 --- a/tests/utf/test_unicodedata.c +++ b/tests/utf/test_unicodedata.c @@ -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);