]> Kevux Git Server - fll/commitdiff
Update: Add the last of the planned f_utf unit tests.
authorKevin Day <thekevinday@gmail.com>
Sat, 25 Jun 2022 15:51:37 +0000 (10:51 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 25 Jun 2022 15:51:37 +0000 (10:51 -0500)
Implement the white space unit tests.

39 files changed:
level_0/f_utf/data/build/settings-tests
level_0/f_utf/data/tests/bytesequences/whitespace-all.txt [new file with mode: 0644]
level_0/f_utf/data/tests/bytesequences/whitespace-modifier.txt [new file with mode: 0644]
level_0/f_utf/data/tests/bytesequences/whitespace-other.txt [new file with mode: 0644]
level_0/f_utf/data/tests/bytesequences/whitespace-zero_width.txt [new file with mode: 0644]
level_0/f_utf/data/tests/codepoints/whitespace-all.txt [new file with mode: 0644]
level_0/f_utf/data/tests/codepoints/whitespace-modifier.txt [new file with mode: 0644]
level_0/f_utf/data/tests/codepoints/whitespace-other.txt [new file with mode: 0644]
level_0/f_utf/data/tests/codepoints/whitespace-zero_width.txt [new file with mode: 0644]
level_0/f_utf/tests/unit/c/data-utf.c
level_0/f_utf/tests/unit/c/data-utf.h
level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic.c
level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic_digit.c
level_0/f_utf/tests/unit/c/test-utf-character_is_alphabetic_numeric.c
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace.c
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-character_is_word.c
level_0/f_utf/tests/unit/c/test-utf-character_is_word_dash.c
level_0/f_utf/tests/unit/c/test-utf-character_is_word_dash_plus.c
level_0/f_utf/tests/unit/c/test-utf-is_alphabetic.c
level_0/f_utf/tests/unit/c/test-utf-is_alphabetic_digit.c
level_0/f_utf/tests/unit/c/test-utf-is_alphabetic_numeric.c
level_0/f_utf/tests/unit/c/test-utf-is_whitespace.c
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.c [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.h [new file with mode: 0644]
level_0/f_utf/tests/unit/c/test-utf-is_word.c
level_0/f_utf/tests/unit/c/test-utf-is_word_dash.c
level_0/f_utf/tests/unit/c/test-utf-is_word_dash_plus.c
level_0/f_utf/tests/unit/c/test-utf.c
level_0/f_utf/tests/unit/c/test-utf.h

index 62e6dcad91dc61d90f8c4330e9029bcd2a7056b9..05f218b70091159c4767039e146052919a439275 100644 (file)
@@ -42,6 +42,9 @@ build_sources_program test-utf-character_is_superscript.c test-utf-is_superscrip
 build_sources_program test-utf-character_is_symbol.c test-utf-is_symbol.c
 build_sources_program test-utf-character_is_valid.c test-utf-is_valid.c
 build_sources_program test-utf-character_is_whitespace.c test-utf-is_whitespace.c
+build_sources_program test-utf-character_is_whitespace_modifier.c test-utf-is_whitespace_modifier.c
+build_sources_program test-utf-character_is_whitespace_other.c test-utf-is_whitespace_other.c
+build_sources_program test-utf-character_is_whitespace_zero_width.c test-utf-is_whitespace_zero_width.c
 build_sources_program test-utf-character_is_wide.c test-utf-is_wide.c
 build_sources_program test-utf-character_is_word.c test-utf-is_word.c
 build_sources_program test-utf-character_is_word_dash.c test-utf-is_word_dash.c
diff --git a/level_0/f_utf/data/tests/bytesequences/whitespace-all.txt b/level_0/f_utf/data/tests/bytesequences/whitespace-all.txt
new file mode 100644 (file)
index 0000000..6ed2817
--- /dev/null
@@ -0,0 +1,17 @@
+32
+49824
+14785152
+14844032
+14844033
+14844034
+14844035
+14844036
+14844037
+14844038
+14844039
+14844040
+14844041
+14844042
+14844079
+14844319
+14909568
diff --git a/level_0/f_utf/data/tests/bytesequences/whitespace-modifier.txt b/level_0/f_utf/data/tests/bytesequences/whitespace-modifier.txt
new file mode 100644 (file)
index 0000000..296f48f
--- /dev/null
@@ -0,0 +1,80 @@
+51888
+51889
+51890
+51891
+51892
+51893
+51894
+51895
+51896
+51897
+51898
+51899
+51900
+51901
+51902
+51903
+52096
+52097
+52098
+52099
+52100
+52101
+52102
+52103
+52104
+52105
+52106
+52107
+52108
+52109
+52110
+52111
+52112
+52113
+52114
+52115
+52116
+52117
+52118
+52119
+52120
+52121
+52122
+52123
+52124
+52125
+52126
+52127
+52128
+52129
+52130
+52131
+52132
+52133
+52134
+52135
+52136
+52137
+52138
+52139
+52140
+52141
+52142
+52143
+52144
+52145
+52146
+52147
+52148
+52149
+52150
+52151
+52152
+52153
+52154
+52155
+52156
+52157
+52158
+52159
diff --git a/level_0/f_utf/data/tests/bytesequences/whitespace-other.txt b/level_0/f_utf/data/tests/bytesequences/whitespace-other.txt
new file mode 100644 (file)
index 0000000..c581199
--- /dev/null
@@ -0,0 +1 @@
+14785152
diff --git a/level_0/f_utf/data/tests/bytesequences/whitespace-zero_width.txt b/level_0/f_utf/data/tests/bytesequences/whitespace-zero_width.txt
new file mode 100644 (file)
index 0000000..f846e4f
--- /dev/null
@@ -0,0 +1 @@
+14844043
diff --git a/level_0/f_utf/data/tests/codepoints/whitespace-all.txt b/level_0/f_utf/data/tests/codepoints/whitespace-all.txt
new file mode 100644 (file)
index 0000000..433ee9f
--- /dev/null
@@ -0,0 +1,14 @@
+U+00A0
+U+2000
+U+2001
+U+2002
+U+2003
+U+2004
+U+2005
+U+2006
+U+2007
+U+2008
+U+2009
+U+200A
+U+200B
+U+3000
diff --git a/level_0/f_utf/data/tests/codepoints/whitespace-modifier.txt b/level_0/f_utf/data/tests/codepoints/whitespace-modifier.txt
new file mode 100644 (file)
index 0000000..be9c212
--- /dev/null
@@ -0,0 +1,80 @@
+U+02B0
+U+02B1
+U+02B2
+U+02B3
+U+02B4
+U+02B5
+U+02B6
+U+02B7
+U+02B8
+U+02B9
+U+02BA
+U+02BB
+U+02BC
+U+02BD
+U+02BE
+U+02BF
+U+02C0
+U+02C1
+U+02C2
+U+02C3
+U+02C4
+U+02C5
+U+02C6
+U+02C7
+U+02C8
+U+02C9
+U+02CA
+U+02CB
+U+02CC
+U+02CD
+U+02CE
+U+02CF
+U+02D0
+U+02D1
+U+02D2
+U+02D3
+U+02D4
+U+02D5
+U+02D6
+U+02D7
+U+02D8
+U+02D9
+U+02DA
+U+02DB
+U+02DC
+U+02DD
+U+02DE
+U+02DF
+U+02E0
+U+02E1
+U+02E2
+U+02E3
+U+02E4
+U+02E5
+U+02E6
+U+02E7
+U+02E8
+U+02E9
+U+02EA
+U+02EB
+U+02EC
+U+02ED
+U+02EE
+U+02EF
+U+02F0
+U+02F1
+U+02F2
+U+02F3
+U+02F4
+U+02F5
+U+02F6
+U+02F7
+U+02F8
+U+02F9
+U+02FA
+U+02FB
+U+02FC
+U+02FD
+U+02FE
+U+02FF
diff --git a/level_0/f_utf/data/tests/codepoints/whitespace-other.txt b/level_0/f_utf/data/tests/codepoints/whitespace-other.txt
new file mode 100644 (file)
index 0000000..e313bd2
--- /dev/null
@@ -0,0 +1 @@
+U+1680
diff --git a/level_0/f_utf/data/tests/codepoints/whitespace-zero_width.txt b/level_0/f_utf/data/tests/codepoints/whitespace-zero_width.txt
new file mode 100644 (file)
index 0000000..ef54693
--- /dev/null
@@ -0,0 +1 @@
+U+200B
index ed036b0540a0023c02c4c82a5b8fdf71598779e0..b66bfc5c6808cef00a855d4431cde07749083116 100644 (file)
@@ -74,6 +74,21 @@ FILE *data__bytesequence_file_open__whitespace(void) {
   return fopen("./data/tests/bytesequences/whitespace-all.txt", "r");
 }
 
+FILE *data__bytesequence_file_open__whitespace__modifier(void) {
+
+  return fopen("./data/tests/bytesequences/whitespace-modifier.txt", "r");
+}
+
+FILE *data__bytesequence_file_open__whitespace__other(void) {
+
+  return fopen("./data/tests/bytesequences/whitespace-other.txt", "r");
+}
+
+FILE *data__bytesequence_file_open__whitespace__zero_width(void) {
+
+  return fopen("./data/tests/bytesequences/whitespace-zero_width.txt", "r");
+}
+
 FILE *data__bytesequence_file_open__wide(void) {
 
   return fopen("./data/tests/bytesequences/wide-all.txt", "r");
@@ -94,17 +109,17 @@ FILE *data__bytesequence_file_open__word_dash_plus(void) {
   return fopen("./data/tests/bytesequences/word_dash_plus-all.txt", "r");
 }
 
-FILE *data__bytesequence_file_open_lax__word(void) {
+FILE *data__bytesequence_file_open__word__lax(void) {
 
   return fopen("./data/tests/bytesequences/word-lax.txt", "r");
 }
 
-FILE *data__bytesequence_file_open_lax__word_dash(void) {
+FILE *data__bytesequence_file_open__word_dash__lax(void) {
 
   return fopen("./data/tests/bytesequences/word_dash-lax.txt", "r");
 }
 
-FILE *data__bytesequence_file_open_lax__word_dash_plus(void) {
+FILE *data__bytesequence_file_open__word_dash_plus__lax(void) {
 
   return fopen("./data/tests/bytesequences/word_dash_plus-lax.txt", "r");
 }
index 6126e34fbb237ea9430a3564594e1d34c6ba53cc..a12bcdc9a83c763bde8247f50596dfd8525d8cf4 100644 (file)
@@ -233,6 +233,51 @@ extern FILE *data__bytesequence_file_open__valid(void);
 extern FILE *data__bytesequence_file_open__whitespace(void);
 
 /**
+ * Open the "whitespace_modifier" bytesequence file, the "modifier" variation.
+ *
+ * This assumes the following:
+ * - The file path is relative to the current working directory (tests are run from project root).
+ * - The file path is "data/tests/bytesequences/whitespace-modifier.txt".
+ *
+ * @return
+ *   Non-zero on success.
+ *   0 on failure.
+ *
+ * @see fopen()
+ */
+extern FILE *data__bytesequence_file_open__whitespace__modifier(void);
+
+/**
+ * Open the "whitespace_other" bytesequence file, the "other" variation.
+ *
+ * This assumes the following:
+ * - The file path is relative to the current working directory (tests are run from project root).
+ * - The file path is "data/tests/bytesequences/whitespace-other.txt".
+ *
+ * @return
+ *   Non-zero on success.
+ *   0 on failure.
+ *
+ * @see fopen()
+ */
+extern FILE *data__bytesequence_file_open__whitespace__other(void);
+
+/**
+ * Open the "whitespace_zero_width" bytesequence file, the "zero_width" variation.
+ *
+ * This assumes the following:
+ * - The file path is relative to the current working directory (tests are run from project root).
+ * - The file path is "data/tests/bytesequences/whitespace-zero_width.txt".
+ *
+ * @return
+ *   Non-zero on success.
+ *   0 on failure.
+ *
+ * @see fopen()
+ */
+extern FILE *data__bytesequence_file_open__whitespace__zero_width(void);
+
+/**
  * Open the "wide" bytesequence file.
  *
  * This assumes the following:
@@ -305,7 +350,7 @@ extern FILE *data__bytesequence_file_open__word_dash_plus(void);
  *
  * @see fopen()
  */
-extern FILE *data__bytesequence_file_open_lax__word(void);
+extern FILE *data__bytesequence_file_open__word__lax(void);
 
 /**
  * Open the "word_dash" bytesequence file, the "lax" variation.
@@ -320,7 +365,7 @@ extern FILE *data__bytesequence_file_open_lax__word(void);
  *
  * @see fopen()
  */
-extern FILE *data__bytesequence_file_open_lax__word_dash(void);
+extern FILE *data__bytesequence_file_open__word_dash__lax(void);
 
 /**
  * Open the "word_dash_plus" bytesequence file, the "lax" variation.
@@ -335,7 +380,7 @@ extern FILE *data__bytesequence_file_open_lax__word_dash(void);
  *
  * @see fopen()
  */
-extern FILE *data__bytesequence_file_open_lax__word_dash_plus(void);
+extern FILE *data__bytesequence_file_open__word_dash_plus__lax(void);
 
 /**
  * Open the "zero_width" bytesequence file.
index 9194cbe23dbe6f6f5b6b2622098d5ec2b2d7a8f3..99ae58dff7cd3c8d11beb22c7bfb4ffffe67a934 100644 (file)
@@ -27,7 +27,7 @@ static inline void private__test__f_utf_character_is_alphabetic__works(const f_s
   else if (f_utf_character_is_combining(sequence)) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence)) {
+  else if (f_utf_character_is_whitespace(sequence, F_true)) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence)) {
index f58a6def8bc620a38708f403ac891655be72866d..ec3722cc3296d772e2ac8ef5282de47c984c3f37 100644 (file)
@@ -30,7 +30,7 @@ static inline void private__test__f_utf_character_is_alphabetic_digit__works(con
   else if (f_utf_character_is_combining(sequence)) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence)) {
+  else if (f_utf_character_is_whitespace(sequence, F_true)) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence)) {
index e13cb3a816b0cf317933d5d87585baf3444e79b6..8bb24c7f88ca648e5484ed88f305f059322386d7 100644 (file)
@@ -30,7 +30,7 @@ static inline void private__test__f_utf_character_is_alphabetic_numeric__works(c
   else if (f_utf_character_is_combining(sequence)) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence)) {
+  else if (f_utf_character_is_whitespace(sequence, F_true)) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence)) {
index bc8e964fc11d4c34320ebae7821e025250af0681..801d43d445a1eeebc9f8a5b7ac260ea6af3303f6 100644 (file)
@@ -21,7 +21,7 @@ void test__f_utf_character_is_whitespace__works(void **state) {
       bytes = data__bytesequence_get_line(file, &sequence);
 
       if (bytes > 0) {
-        const f_status_t status = f_utf_character_is_whitespace(sequence);
+        const f_status_t status = f_utf_character_is_whitespace(sequence, F_true);
 
         assert_int_equal(status, F_true);
       }
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.c
new file mode 100644 (file)
index 0000000..47c6308
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-utf.h"
+#include "test-utf-character_is_whitespace_modifier.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_character_is_whitespace_modifier__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__modifier();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const f_status_t status = f_utf_character_is_whitespace_modifier(sequence);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.h b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_modifier.h
new file mode 100644 (file)
index 0000000..0e913cf
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_character_is_whitespace_modifier_h
+#define _TEST__F_utf_character_is_whitespace_modifier_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_character_is_whitespace_modifier()
+ */
+extern void test__f_utf_character_is_whitespace_modifier__works(void **state);
+
+#endif // _TEST__F_utf_character_is_whitespace_modifier_h
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.c
new file mode 100644 (file)
index 0000000..de038a1
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-utf.h"
+#include "test-utf-character_is_whitespace_other.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_character_is_whitespace_other__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__other();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const f_status_t status = f_utf_character_is_whitespace_other(sequence);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.h b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_other.h
new file mode 100644 (file)
index 0000000..73a2b8e
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_character_is_whitespace_other_h
+#define _TEST__F_utf_character_is_whitespace_other_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_character_is_whitespace_other()
+ */
+extern void test__f_utf_character_is_whitespace_other__works(void **state);
+
+#endif // _TEST__F_utf_character_is_whitespace_other_h
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.c b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.c
new file mode 100644 (file)
index 0000000..dca1919
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-utf.h"
+#include "test-utf-character_is_whitespace_zero_width.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_character_is_whitespace_zero_width__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__zero_width();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const f_status_t status = f_utf_character_is_whitespace_zero_width(sequence);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.h b/level_0/f_utf/tests/unit/c/test-utf-character_is_whitespace_zero_width.h
new file mode 100644 (file)
index 0000000..108ff94
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_character_is_whitespace_zero_width_h
+#define _TEST__F_utf_character_is_whitespace_zero_width_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_character_is_whitespace_zero_width()
+ */
+extern void test__f_utf_character_is_whitespace_zero_width__works(void **state);
+
+#endif // _TEST__F_utf_character_is_whitespace_zero_width_h
index f622f8f786dbb5fdf0b37e7725cab9721f05e5ab..c433a15a0598e79d0254ec415c61d5e010572098 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_character_is_word__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word();
+    FILE *file = data__bytesequence_file_open__word__lax();
 
     assert_non_null(file);
 
index f2c2411539ca82e59a306e1e60c417cf73713857..580cf92544477765d102a563496ba0990e80b440 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_character_is_word_dash__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word_dash();
+    FILE *file = data__bytesequence_file_open__word_dash__lax();
 
     assert_non_null(file);
 
index 70f08329d266231af3b77a87af900c4d10cafab9..6d2a76fbf0d118b9895799523dab71ecc7bc8c27 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_character_is_word_dash_plus__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word_dash_plus();
+    FILE *file = data__bytesequence_file_open__word_dash_plus__lax();
 
     assert_non_null(file);
 
index 8ec43cb54ffc0ab153666ac247707c16be452efb..a0eca429f5c9210e295221c6d1e5d1d301f7e120 100644 (file)
@@ -27,7 +27,7 @@ static inline void private__test__f_utf_is_alphabetic__works(const f_status_t st
   else if (f_utf_character_is_combining(sequence) == F_true) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence) == F_true) {
+  else if (f_utf_character_is_whitespace(sequence, F_true) == F_true) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence) == F_true) {
index 586a2548e3c3de36155ad1bf9d23082c828f8e8f..74bbad6aaf2a1863e3fb4c6c67aa1b51625142e6 100644 (file)
@@ -30,7 +30,7 @@ static inline void private__test__f_utf_is_alphabetic_digit__works(const f_statu
   else if (f_utf_character_is_combining(sequence) == F_true) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence) == F_true) {
+  else if (f_utf_character_is_whitespace(sequence, F_true) == F_true) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence) == F_true) {
index 700070c10eb11d70ffb148931b8a69c16fdcd262..665a3ea73bea385d38826e6a3c8013c02afc526b 100644 (file)
@@ -30,7 +30,7 @@ static inline void private__test__f_utf_is_alphabetic_numeric__works(const f_sta
   else if (f_utf_character_is_combining(sequence) == F_true) {
     assert_int_equal(status, F_false);
   }
-  else if (f_utf_character_is_whitespace(sequence) == F_true) {
+  else if (f_utf_character_is_whitespace(sequence, F_true) == F_true) {
     assert_int_equal(status, F_false);
   }
   else if (f_utf_character_is_whitespace_modifier(sequence) == F_true) {
index eede6039acf1da2631edb6de01b9dc64856608db..ba7889480a05c6c87d47ba805575ac4b512f4c17 100644 (file)
@@ -38,7 +38,7 @@ void test__f_utf_is_whitespace__works(void **state) {
           }
         }
 
-        const f_status_t status = f_utf_is_whitespace(buffer, 5);
+        const f_status_t status = f_utf_is_whitespace(buffer, 5, F_true);
 
         assert_int_equal(status, F_true);
       }
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.c b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.c
new file mode 100644 (file)
index 0000000..57c5771
--- /dev/null
@@ -0,0 +1,56 @@
+#include "test-utf.h"
+#include "test-utf-is_whitespace_modifier.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_is_whitespace_modifier__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__modifier();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const uint8_t width = macro_f_utf_char_t_width(sequence);
+        char buffer[5] = { 0, 0, 0, 0, 0 };
+
+        buffer[0] = macro_f_utf_char_t_to_char_1(sequence);
+
+        if (width > 1) {
+          buffer[1] = macro_f_utf_char_t_to_char_2(sequence);
+
+          if (width > 2) {
+            buffer[2] = macro_f_utf_char_t_to_char_3(sequence);
+
+            if (width > 3) {
+              buffer[3] = macro_f_utf_char_t_to_char_4(sequence);
+            }
+          }
+        }
+
+        const f_status_t status = f_utf_is_whitespace_modifier(buffer, 5);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.h b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_modifier.h
new file mode 100644 (file)
index 0000000..d9637d7
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_is_whitespace_modifier_h
+#define _TEST__F_utf_is_whitespace_modifier_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_is_whitespace_modifier()
+ */
+extern void test__f_utf_is_whitespace_modifier__works(void **state);
+
+#endif // _TEST__F_utf_is_whitespace_modifier_h
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.c b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.c
new file mode 100644 (file)
index 0000000..5690110
--- /dev/null
@@ -0,0 +1,56 @@
+#include "test-utf.h"
+#include "test-utf-is_whitespace_other.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_is_whitespace_other__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__other();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const uint8_t width = macro_f_utf_char_t_width(sequence);
+        char buffer[5] = { 0, 0, 0, 0, 0 };
+
+        buffer[0] = macro_f_utf_char_t_to_char_1(sequence);
+
+        if (width > 1) {
+          buffer[1] = macro_f_utf_char_t_to_char_2(sequence);
+
+          if (width > 2) {
+            buffer[2] = macro_f_utf_char_t_to_char_3(sequence);
+
+            if (width > 3) {
+              buffer[3] = macro_f_utf_char_t_to_char_4(sequence);
+            }
+          }
+        }
+
+        const f_status_t status = f_utf_is_whitespace_other(buffer, 5);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.h b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_other.h
new file mode 100644 (file)
index 0000000..d7787a3
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_is_whitespace_other_h
+#define _TEST__F_utf_is_whitespace_other_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_is_whitespace_other()
+ */
+extern void test__f_utf_is_whitespace_other__works(void **state);
+
+#endif // _TEST__F_utf_is_whitespace_other_h
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.c b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.c
new file mode 100644 (file)
index 0000000..bc5dbe9
--- /dev/null
@@ -0,0 +1,56 @@
+#include "test-utf.h"
+#include "test-utf-is_whitespace_zero_width.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_is_whitespace_zero_width__works(void **state) {
+
+  {
+    FILE *file = data__bytesequence_file_open__whitespace__zero_width();
+
+    assert_non_null(file);
+
+    f_utf_char_t sequence = 0;
+    ssize_t bytes = 0;
+
+    f_array_length_t line = 0;
+
+    do {
+      bytes = data__bytesequence_get_line(file, &sequence);
+
+      if (bytes > 0) {
+        const uint8_t width = macro_f_utf_char_t_width(sequence);
+        char buffer[5] = { 0, 0, 0, 0, 0 };
+
+        buffer[0] = macro_f_utf_char_t_to_char_1(sequence);
+
+        if (width > 1) {
+          buffer[1] = macro_f_utf_char_t_to_char_2(sequence);
+
+          if (width > 2) {
+            buffer[2] = macro_f_utf_char_t_to_char_3(sequence);
+
+            if (width > 3) {
+              buffer[3] = macro_f_utf_char_t_to_char_4(sequence);
+            }
+          }
+        }
+
+        const f_status_t status = f_utf_is_whitespace_zero_width(buffer, 5);
+
+        assert_int_equal(status, F_true);
+      }
+
+      ++line;
+
+    } while (bytes > 0);
+
+    fclose(file);
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.h b/level_0/f_utf/tests/unit/c/test-utf-is_whitespace_zero_width.h
new file mode 100644 (file)
index 0000000..6be4ae0
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the function in the utf project.
+ */
+#ifndef _TEST__F_utf_is_whitespace_zero_width_h
+#define _TEST__F_utf_is_whitespace_zero_width_h
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_is_whitespace_zero_width()
+ */
+extern void test__f_utf_is_whitespace_zero_width__works(void **state);
+
+#endif // _TEST__F_utf_is_whitespace_zero_width_h
index 9c75ec766e1bf7def4dd1804d3e50fc9b7e916d8..3d35ba461102fe44ca32078e26f38c1f561c26e9 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_is_word__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word();
+    FILE *file = data__bytesequence_file_open__word__lax();
 
     assert_non_null(file);
 
index 4b8bb4570da0ee4b2d150e1481cf171bae66e7b4..d65d1ae2a43bbadf52d689b46b51325d311233ae 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_is_word_dash__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word_dash();
+    FILE *file = data__bytesequence_file_open__word_dash__lax();
 
     assert_non_null(file);
 
index 0f0ed19354544586a2fa04f504425b5f05b0f445..50da2760b81a3c46b87d696358b7a5da48b11944 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 void test__f_utf_is_word_dash_plus__strict_is_false(void **state) {
 
   {
-    FILE *file = data__bytesequence_file_open_lax__word_dash_plus();
+    FILE *file = data__bytesequence_file_open__word_dash_plus__lax();
 
     assert_non_null(file);
 
index 81dbe343e6f6b1d3dd1922412660204614ca5f53..0401e5674f7bb42012bd5c7a71b5522a650f4c99 100644 (file)
@@ -39,7 +39,10 @@ int main(void) {
     cmocka_unit_test(test__f_utf_character_is_superscript__works),
     cmocka_unit_test(test__f_utf_character_is_symbol__works),
     cmocka_unit_test(test__f_utf_character_is_valid__works),
-    //cmocka_unit_test(test__f_utf_character_is_whitespace__works),
+    cmocka_unit_test(test__f_utf_character_is_whitespace__works),
+    cmocka_unit_test(test__f_utf_character_is_whitespace_modifier__works),
+    cmocka_unit_test(test__f_utf_character_is_whitespace_other__works),
+    cmocka_unit_test(test__f_utf_character_is_whitespace_zero_width__works),
     cmocka_unit_test(test__f_utf_character_is_wide__works),
     cmocka_unit_test(test__f_utf_character_is_zero_width__works),
 
@@ -155,7 +158,10 @@ int main(void) {
     cmocka_unit_test(test__f_utf_is_superscript__works),
     cmocka_unit_test(test__f_utf_is_symbol__works),
     cmocka_unit_test(test__f_utf_is_valid__works),
-    //cmocka_unit_test(test__f_utf_is_whitespace__works),
+    cmocka_unit_test(test__f_utf_is_whitespace__works),
+    cmocka_unit_test(test__f_utf_is_whitespace_modifier__works),
+    cmocka_unit_test(test__f_utf_is_whitespace_other__works),
+    cmocka_unit_test(test__f_utf_is_whitespace_zero_width__works),
     cmocka_unit_test(test__f_utf_is_wide__works),
     cmocka_unit_test(test__f_utf_is_zero_width__works),
 
index b96c4a8eb57d86c684ed0bce8b6deaf3c5e5c9ce..00d8969093009f96616e08ccf3d3e3cc57088899 100644 (file)
@@ -50,6 +50,9 @@
 #include "test-utf-character_is_symbol.h"
 #include "test-utf-character_is_valid.h"
 #include "test-utf-character_is_whitespace.h"
+#include "test-utf-character_is_whitespace_modifier.h"
+#include "test-utf-character_is_whitespace_other.h"
+#include "test-utf-character_is_whitespace_zero_width.h"
 #include "test-utf-character_is_wide.h"
 #include "test-utf-character_is_word.h"
 #include "test-utf-character_is_word_dash.h"
 #include "test-utf-is_symbol.h"
 #include "test-utf-is_valid.h"
 #include "test-utf-is_whitespace.h"
+#include "test-utf-is_whitespace_modifier.h"
+#include "test-utf-is_whitespace_other.h"
+#include "test-utf-is_whitespace_zero_width.h"
 #include "test-utf-is_wide.h"
 #include "test-utf-is_word.h"
 #include "test-utf-is_word_dash.h"