summaryrefslogtreecommitdiff
path: root/src/target/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/test.c')
-rw-r--r--src/target/test.c89
1 files changed, 11 insertions, 78 deletions
diff --git a/src/target/test.c b/src/target/test.c
index b807b92..a92642a 100644
--- a/src/target/test.c
+++ b/src/target/test.c
@@ -1,79 +1,20 @@
#include "munit.h"
-#include "unicode.h"
-
-struct u_pair {
- char *utf8;
- wchar_t *utf32;
-};
-
-struct u_pair text_fixture[] = {
- {
- .utf8 = "Single byte ascii symbols string",
- .utf32 = L"Single byte ascii symbols string"
- },
- {
- .utf8 = "\u041A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0430",
- .utf32 = L"\u041A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0430"
- },
- {
- .utf8 = "\u0814\u0820\u080C\u081D\u0813\u0829\u0809\u080C",
- .utf32 = L"\u0814\u0820\u080C\u081D\u0813\u0829\u0809\u080C"
- },
- {
- .utf8 = "𓁹",
- .utf32 = L"𓁹"
- }
-};
-
-
-static void *test_utf8_strlen_setup(const MunitParameter params[],
- void *user_data)
-{
- (void) params;
- (void) user_data;
-
- return text_fixture;
-}
-
-static MunitResult test_utf8_strlen(const MunitParameter params[],
- void *fixture)
+static void *test_dummy_setup(
+ const MunitParameter params[],
+ void *user_data)
{
(void) params;
- struct u_pair *f = fixture;
- for (int i = 0; i < 4; i++)
- munit_assert_ulong(utf8_strlen(f[i].utf8) * (i + 1),
- ==, strlen(f[i].utf8));
-
- return MUNIT_OK;
-}
-
-static void *test_utf8to32_strcpy_setup(const MunitParameter params[],
- void *user_data)
-{
- (void) params;
- (void) user_data;
-
- return text_fixture;
+ return user_data;
}
-static MunitResult test_utf8to32_strcpy(const MunitParameter params[],
- void *fixture)
+static MunitResult test_dummy(
+ const MunitParameter params[],
+ void *fixture)
{
(void) params;
-
- struct u_pair *f = fixture;
- size_t len;
- wchar_t *str;
-
- for (int i = 0; i < 4; i++) {
- len = utf8_strlen(f[i].utf8);
- str = malloc((len + 1) * sizeof(wchar_t));
- utf8to32_strcpy(str, f[i].utf8);
- munit_assert_uint(memcmp(str, f[i].utf32, len), ==, 0);
- free(str);
- }
+ (void) fixture;
return MUNIT_OK;
}
@@ -82,17 +23,9 @@ static const MunitSuite test_suite = {
"unit",
(MunitTest[]){
{
- "/unicode/utf8_strlen",
- test_utf8_strlen,
- test_utf8_strlen_setup,
- NULL,
- MUNIT_TEST_OPTION_NONE,
- NULL
- },
- {
- "/unicode/utf8to32_strcpy",
- test_utf8to32_strcpy,
- test_utf8to32_strcpy_setup,
+ "/dummy/dummy",
+ test_dummy,
+ test_dummy_setup,
NULL,
MUNIT_TEST_OPTION_NONE,
NULL