From 0c88e55fa8f132e8ac15426911d155f136078302 Mon Sep 17 00:00:00 2001 From: Martin Baƙinka Date: Mon, 3 May 2021 12:43:54 +0200 Subject: fixed division, undefined behaviors and some improvements (#33) * testing using ctest * emove old testing script * added github workflow CI * updated CI * added unit test for macros * F16() and F16C() are both rounding allways, so fix16_from_dbl should as well * added tests for strign operations, but these functions are in my opinion unreliable and tests are failing * removed old unittests * removed old unittests from cmake * problem with division using gcc * improved benchmark * clarification of problem with division * attempt to fix * fixed some undefined behaviors, fixed division --- tests/tests.cmake | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/tests.cmake') diff --git a/tests/tests.cmake b/tests/tests.cmake index 5f6c90b..c07b69d 100644 --- a/tests/tests.cmake +++ b/tests/tests.cmake @@ -15,15 +15,22 @@ set(nn08 PREFIX=nn08 FIXMATH_NO_OVERFLOW FIXMATH_NO_ROUNDING FIXMATH_OPTIMIZE_8B enable_testing() +#-fno-sanitize-recover +set(sanitizer_opts -fsanitize=undefined) + add_custom_target(make_tests) function(create_variant name defs) add_library(libfixmath_${name} STATIC ${libfixmath-srcs}) target_compile_definitions(libfixmath_${name} PRIVATE ${defs}) + target_compile_options(libfixmath_${name} PRIVATE ${sanitizer_opts}) + target_link_options(libfixmath_${name} PRIVATE ${sanitizer_opts}) add_executable(tests_${name} ${tests-srcs}) target_link_libraries(tests_${name} PRIVATE libfixmath_${name} m) target_include_directories(tests_${name} PRIVATE ${CMAKE_SOURCE_DIR}) target_compile_definitions(tests_${name} PRIVATE ${defs}) + target_compile_options(tests_${name} PRIVATE ${sanitizer_opts}) + target_link_options(tests_${name} PRIVATE ${sanitizer_opts}) add_dependencies(make_tests tests_${name}) add_test(NAME tests_${name} COMMAND tests_${name}) endfunction() -- cgit v1.2.3