Browse Source
compile more tests on Windows (#183)
* compile more tests on Windows
* still disable charwidth tests
* silence warnings on MSVC about sscanf
* whoops
* silence warning
pull/188/head
Steven G. Johnson
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
15 additions and
12 deletions
-
CMakeLists.txt
-
test/graphemetest.c
-
test/tests.h
|
|
@ -82,15 +82,15 @@ if(UTF8PROC_ENABLE_TESTING) |
|
|
|
add_test(testprintproperty printproperty) |
|
|
|
add_test(testvalid valid) |
|
|
|
if (NOT WIN32) |
|
|
|
# Some test disabled, because they don't compile on Windows, missing getline, ... |
|
|
|
# no wcwidth function on Windows |
|
|
|
add_executable(charwidth test/tests.h test/tests.c utf8proc.h test/charwidth.c) |
|
|
|
target_link_libraries(charwidth utf8proc) |
|
|
|
add_test(testcharwidth charwidth) |
|
|
|
endif() |
|
|
|
add_executable(graphemetest test/tests.h test/tests.c utf8proc.h test/graphemetest.c) |
|
|
|
target_link_libraries(graphemetest utf8proc) |
|
|
|
add_executable(normtest test/tests.h test/tests.c utf8proc.h test/normtest.c) |
|
|
|
target_link_libraries(normtest utf8proc) |
|
|
|
add_test(testcharwidth charwidth) |
|
|
|
#add_test(testgraphemetest graphemetest data/GraphemeBreakTest.txt) |
|
|
|
#add_test(testnormtest normtest data/NormalizationTest.txt) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
@ -42,7 +42,7 @@ int main(int argc, char **argv) |
|
|
|
if (si) { |
|
|
|
utf8proc_uint8_t utf8[1024]; /* copy src without 0xff grapheme separators */ |
|
|
|
size_t i = 0, j = 0; |
|
|
|
utf8proc_ssize_t glen; |
|
|
|
utf8proc_ssize_t glen, k; |
|
|
|
utf8proc_uint8_t *g; /* utf8proc_map grapheme results */ |
|
|
|
while (i < si) { |
|
|
|
if (src[i] != '/') |
|
|
@ -58,9 +58,9 @@ int main(int argc, char **argv) |
|
|
|
else { |
|
|
|
check(glen >= 0, "utf8proc_map error = %s", |
|
|
|
utf8proc_errmsg(glen)); |
|
|
|
for (i = 0; i <= glen; ++i) |
|
|
|
if (g[i] == 0xff) |
|
|
|
g[i] = '/'; /* easier-to-read output (/ is not in test strings) */ |
|
|
|
for (k = 0; k <= glen; ++k) |
|
|
|
if (g[k] == 0xff) |
|
|
|
g[k] = '/'; /* easier-to-read output (/ is not in test strings) */ |
|
|
|
check(!strcmp((char*)g, (char*)src), |
|
|
|
"grapheme mismatch: \"%s\" instead of \"%s\"", (char*)g, (char*)src); |
|
|
|
} |
|
|
|
|
|
@ -1,13 +1,16 @@ |
|
|
|
/* Common functions and includes for our test programs. */ |
|
|
|
|
|
|
|
/*
|
|
|
|
* Set feature macro to enable getline() and wcwidth(). |
|
|
|
* Set feature macro to enable wcwidth(). |
|
|
|
* |
|
|
|
* Please refer to section 2.2.1 of POSIX.1-2008: |
|
|
|
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_01_02
|
|
|
|
*/ |
|
|
|
#define _XOPEN_SOURCE 700 |
|
|
|
|
|
|
|
/* silence warnings about sscanf on Windows */ |
|
|
|
#define _CRT_SECURE_NO_WARNINGS |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <ctype.h> |
|
|
|