hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.46k stars 310 forks source link

Fix the tests to really check the assertions in Release mode #159

Closed SpaceIm closed 2 years ago

SpaceIm commented 2 years ago

Current tests are based on assert, which is no-op in Release mode since NDEBUG definition is injected. CI files run the build in Release mode, so it doesn't really test the library, except that lib & program are able to compile, link and run.

SpaceIm commented 2 years ago

Visual Studio fails in 2 more test files (2 are already disabled due to SEGFAULT).

dataframe_tester.cc

Testing gen_datetime_index() ...
Assertion failed: idx_vec1.size() == 768600, file C:\Repos\source\test\dataframe_tester.cc, line 2453

date_time_tester.cc

ERROR: 1547128583.123456987 != 1547146583.123456987
Assertion failed: dt1.long_time() == 1558538105123456789, file C:\Repos\source\test\date_time_tester.cc, line 832
hosseinmoein commented 2 years ago

@SpaceIm , There are two problems with these tests which is why I am not crazy about running them on all systems 

  1. There are precision discrepancies.2. The starting point for some of the solutions to these algorithms are based on random numbers. And they may have more than one correct answer. Random numbers on different system are generated differently 
SpaceIm commented 2 years ago

@hosseinmoein understood, but original issue is still there: nothing is really tested in Release mode, which runs in CI. Try to change anything in assertion of the tests, tests are still successful.

hosseinmoein commented 2 years ago

That's a good point, although I always test stuff before merging into the master. Let me think about This. Maybe, I should separate all the algorithms that are nondeterministic into a separate program.