mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
Enable sanitizers in tests
These all throw a fit when pointed at cpython unfortunately
This commit is contained in:
parent
32a411634e
commit
dcd9bf4287
@ -16,6 +16,11 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${TEST_SOURCE_FILES} ${TEST_
|
||||
|
||||
add_executable(Test ${TEST_SOURCE_FILES} ${TEST_HEADER_FILES})
|
||||
|
||||
if ((NOT MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))
|
||||
target_compile_options(Test PUBLIC -fsanitize=address,undefined,unsigned-integer-overflow -fno-sanitize-recover=address,undefined,unsigned-integer-overflow -fno-omit-frame-pointer)
|
||||
target_link_options(Test PUBLIC -fsanitize=address,undefined,unsigned-integer-overflow -fno-sanitize-recover=address,undefined,unsigned-integer-overflow -fno-omit-frame-pointer)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(Test PUBLIC quicktex gtest_main)
|
||||
|
||||
include(GoogleTest)
|
||||
|
@ -60,7 +60,7 @@ template <typename T> class MatrixTest : public testing::Test {
|
||||
template <typename M> constexpr M sqr(T start = 0, T stride = 1) {
|
||||
M result(0);
|
||||
for (unsigned i = 0; i < M::elements; i++) {
|
||||
result.element(i) = static_cast<T>((i + start) * (i + start) * stride);
|
||||
result.element(i) = (static_cast<T>(i) + start) * (static_cast<T>(i) + start) * stride;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -219,7 +219,7 @@ TYPED_TEST(MatrixTest, sum) {
|
||||
}
|
||||
|
||||
if constexpr (!std::unsigned_integral<typename M::value_type>) {
|
||||
EXPECT_FLOAT_EQ(M(-1).sum(), -1 * (int) M::elements);
|
||||
EXPECT_FLOAT_EQ(M(-1).sum(), -1 * (int)M::elements);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user