added test for #128
This commit is contained in:
parent
acc204f1f1
commit
53d7968055
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ test/normtest
|
|||||||
test/graphemetest
|
test/graphemetest
|
||||||
test/printproperty
|
test/printproperty
|
||||||
test/charwidth
|
test/charwidth
|
||||||
|
test/misc
|
||||||
test/valid
|
test/valid
|
||||||
test/iterate
|
test/iterate
|
||||||
test/case
|
test/case
|
||||||
|
|||||||
6
Makefile
6
Makefile
@ -138,11 +138,15 @@ test/case: test/case.c test/tests.o utf8proc.o utf8proc.h test/tests.h
|
|||||||
test/custom: test/custom.c test/tests.o utf8proc.o utf8proc.h test/tests.h
|
test/custom: test/custom.c test/tests.o utf8proc.o utf8proc.h test/tests.h
|
||||||
$(CC) $(UCFLAGS) test/custom.c test/tests.o utf8proc.o -o $@
|
$(CC) $(UCFLAGS) test/custom.c test/tests.o utf8proc.o -o $@
|
||||||
|
|
||||||
check: test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/custom test/charwidth test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o
|
test/misc: test/misc.c test/tests.o utf8proc.o utf8proc.h test/tests.h
|
||||||
|
$(CC) $(UCFLAGS) test/misc.c test/tests.o utf8proc.o -o $@
|
||||||
|
|
||||||
|
check: test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/custom test/charwidth test/misc test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o
|
||||||
$(MAKE) -C bench
|
$(MAKE) -C bench
|
||||||
test/normtest data/NormalizationTest.txt
|
test/normtest data/NormalizationTest.txt
|
||||||
test/graphemetest data/GraphemeBreakTest.txt
|
test/graphemetest data/GraphemeBreakTest.txt
|
||||||
test/charwidth
|
test/charwidth
|
||||||
|
test/misc
|
||||||
test/valid
|
test/valid
|
||||||
test/iterate
|
test/iterate
|
||||||
test/case
|
test/case
|
||||||
|
|||||||
25
test/misc.c
Normal file
25
test/misc.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Miscellaneous tests, e.g. regression tests */
|
||||||
|
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
void issue128(void) /* #128 */
|
||||||
|
{
|
||||||
|
utf8proc_uint8_t input[] = {0x72, 0xcc, 0x87, 0xcc, 0xa3, 0x00}; /* "r\u0307\u0323" */
|
||||||
|
utf8proc_uint8_t nfc[] = {0xe1, 0xb9, 0x9b, 0xcc, 0x87, 0x00}; /* "\u1E5B\u0307" */
|
||||||
|
utf8proc_uint8_t nfd[] = {0x72, 0xcc, 0xa3, 0xcc, 0x87, 0x00}; /* "r\u0323\u0307" */
|
||||||
|
utf8proc_uint8_t *nfc_out, *nfd_out;
|
||||||
|
nfc_out = utf8proc_NFC(input);
|
||||||
|
printf("NFC \"%s\" -> \"%s\" vs. \"%s\"\n", (char*)input, (char*)nfc_out, (char*)nfc);
|
||||||
|
check(strlen((char*) nfc_out) == 5, "incorrect nfc length");
|
||||||
|
check(!memcmp(nfc, nfc_out, 6), "incorrect nfc data");
|
||||||
|
nfd_out = utf8proc_NFD(input);
|
||||||
|
printf("NFD \"%s\" -> \"%s\" vs. \"%s\"\n", (char*)input, (char*)nfd_out, (char*)nfd);
|
||||||
|
check(strlen((char*) nfd_out) == 5, "incorrect nfd length");
|
||||||
|
check(!memcmp(nfd, nfd_out, 6), "incorrect nfd data");
|
||||||
|
free(nfd_out); free(nfc_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
issue128();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user