JuliaStrings / utf8proc

a clean C library for processing UTF-8 Unicode data

Home Page:http://juliastrings.github.io/utf8proc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it intended that the tests are missing in the CMakeLists.txt?

Andreas-Schniertshauer opened this issue · comments

We primarily use the Makefile for development. CMakeLists.txt is only to simplify installation for Windows users.

I added the following to the CMakeLists.txt file:
if(UTF8PROC_ENABLE_TESTING) enable_testing() add_executable(case test/tests.h test/tests.c utf8proc.h test/case.c) target_link_libraries(case utf8proc) add_executable(charwidth test/tests.h test/tests.c utf8proc.h test/charwidth.c) target_link_libraries(charwidth utf8proc) add_executable(custom test/tests.h test/tests.c utf8proc.h test/custom.c) target_link_libraries(custom utf8proc) add_executable(graphemetest test/tests.h test/tests.c utf8proc.h test/graphemetest.c) target_link_libraries(graphemetest utf8proc) add_executable(iterate test/tests.h test/tests.c utf8proc.h test/iterate.c) target_link_libraries(iterate utf8proc) add_executable(misc test/tests.h test/tests.c utf8proc.h test/misc.c) target_link_libraries(misc utf8proc) add_executable(normtest test/tests.h test/tests.c utf8proc.h test/normtest.c) target_link_libraries(normtest utf8proc) add_executable(printproperty test/tests.h test/tests.c utf8proc.h test/printproperty.c) target_link_libraries(printproperty utf8proc) add_executable(valid test/tests.h test/tests.c utf8proc.h test/valid.c) target_link_libraries(valid utf8proc) add_test(testcase case) add_test(testcustom custom) add_test(testiterate iterate) add_test(testmisc misc) add_test(testprintproperty printproperty) add_test(testvalid valid) endif()
Did not add testcharwidth, testgraphemetest and testnormtest because of compiler error on Windows missing getline and wcwidth.

All added tests pass on Windows with Visual Studio 2019 16.3.10 but get a lot of warnings when compiling, e.g.:
tests.c(42,1): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. iterate.c(44,9): warning C4244: '=': conversion from 'uint32_t' to 'unsigned char', possible loss of data case.c(30,38): warning C4244: 'function': conversion from 'utf8proc_int32_t' to 'wint_t', possible loss of data iterate.c(33,27): warning C4100: 'argv': unreferenced formal parameter

Those warnings are innocuous, I believe. A PR that adds tests to the cmake script would be welcomed. We would also welcome a PR with some type casts that silence the conversion warnings in the tests.

I added the tests see #173