diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2024-02-21 17:03:45 -0500 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2024-02-21 17:03:45 -0500 |
| commit | 0fcf63e9e47bae61b9f7289c157b28ec294c2e24 (patch) | |
| tree | 420d860c8fb92637d46f6ae2dfbcdde7b047e2cc | |
| parent | 49bceabf90d114b89638659141d54083c1b7f395 (diff) | |
| download | dynamic-extension-0fcf63e9e47bae61b9f7289c157b28ec294c2e24.tar.gz | |
Triespline: added test to verify that crash is not due to this project
| -rw-r--r-- | CMakeLists.txt | 6 | ||||
| -rw-r--r-- | tests/triespline_debug.cpp | 63 |
2 files changed, 69 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 81fdb63..31bc75a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,12 @@ if (tests) target_include_directories(pgm_tests PRIVATE include external/PGM-index/include external/psudb-common/cpp/include) target_link_options(pgm_tests PUBLIC -mcx16) target_compile_options(pgm_tests PUBLIC -fopenmp) + + + add_executable(triespline_debug ${CMAKE_CURRENT_SOURCE_DIR}/tests/triespline_debug.cpp) + target_link_libraries(triespline_debug PUBLIC gsl check subunit pthread atomic) + target_link_options(triespline_debug PUBLIC -mcx16) + target_include_directories(triespline_debug PRIVATE include external/psudb-common/cpp/include external/PLEX/include) endif() if (bench) diff --git a/tests/triespline_debug.cpp b/tests/triespline_debug.cpp new file mode 100644 index 0000000..4949cd0 --- /dev/null +++ b/tests/triespline_debug.cpp @@ -0,0 +1,63 @@ +/* + * tests/internal_level_tests.cpp + * + * Unit tests for InternalLevel + * + * Copyright (C) 2023 Douglas Rumbaugh <drumbaugh@psu.edu> + * Dong Xie <dongx@psu.edu> + * + * Distributed under the Modified BSD License. + * + */ + +#include <functional> +#include "ts/builder.h" + +#include <check.h> + + +START_TEST(t_sequential_integers) +{ + size_t n = 4097; + auto bldr = ts::Builder<size_t>(436712, 440808, 1024); + + for (size_t i=436712; i<n + 436712; i++) { + bldr.AddKey(i); + } + + auto ts = bldr.Finalize(); +} + + +Suite *unit_testing() +{ + Suite *unit = suite_create("InternalLevel Unit Testing"); + + TCase *ts = tcase_create("TrieSpline::debugging"); + tcase_add_test(ts, t_sequential_integers); + tcase_set_timeout(ts, 1000); + suite_add_tcase(unit, ts); + + return unit; +} + +int run_unit_tests() +{ + int failed = 0; + Suite *unit = unit_testing(); + SRunner *unit_runner = srunner_create(unit); + + srunner_run_all(unit_runner, CK_NORMAL); + failed = srunner_ntests_failed(unit_runner); + srunner_free(unit_runner); + + return failed; +} + + +int main() +{ + int unit_failed = run_unit_tests(); + + return (unit_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} |