diff --git a/.gitignore b/.gitignore index ef6a007483b..d5b03d40713 100644 --- a/.gitignore +++ b/.gitignore @@ -79,7 +79,6 @@ src/tscore/ParseRulesCType src/tscore/ParseRulesCTypeToLower src/tscore/ParseRulesCTypeToUpper src/tscore/mkdfa -src/tscore/test_List src/tscore/test_arena src/tscore/test_atomic src/tscore/test_freelist diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am index 8e82d165ff4..af7e2d72a02 100644 --- a/src/tscore/Makefile.am +++ b/src/tscore/Makefile.am @@ -19,7 +19,7 @@ include $(top_srcdir)/build/tidy.mk noinst_PROGRAMS = mkdfa CompileParseRules -check_PROGRAMS = test_arena test_atomic test_freelist test_geometry test_List test_Vec test_X509HostnameValidator test_tscore +check_PROGRAMS = test_arena test_atomic test_freelist test_geometry test_Vec test_X509HostnameValidator test_tscore TESTS_ENVIRONMENT = LSAN_OPTIONS=suppressions=suppression.txt @@ -237,7 +237,6 @@ test_freelist_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.l test_arena_SOURCES = test_arena.cc test_arena_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBTCL@ @LIBPCRE@ -test_List_SOURCES = test_List.cc test_Vec_SOURCES = test_Vec.cc test_Vec_LDADD = libtscore.la $(top_builddir)/src/tscpp/util/libtscpputil.la @LIBTCL@ @LIBPCRE@ @@ -267,6 +266,7 @@ test_tscore_SOURCES = \ unit_tests/test_IpMap.cc \ unit_tests/test_layout.cc \ unit_tests/test_Map.cc \ + unit_tests/test_List.cc \ unit_tests/test_MemSpan.cc \ unit_tests/test_MemArena.cc \ unit_tests/test_MT_hashtable.cc \ diff --git a/src/tscore/test_List.cc b/src/tscore/unit_tests/test_List.cc similarity index 90% rename from src/tscore/test_List.cc rename to src/tscore/unit_tests/test_List.cc index 0407ed7f94d..ad6dad0fdb0 100644 --- a/src/tscore/test_List.cc +++ b/src/tscore/unit_tests/test_List.cc @@ -21,6 +21,8 @@ limitations under the License. */ +#include "catch.hpp" + #include "tscore/List.h" class Foo @@ -39,8 +41,7 @@ class Foo Foo(int i = 0) : x(i) {} }; -int -main() +TEST_CASE("test list", "[libts][List]") { SList(Foo, slink) s; DList(Foo, dlink) d; @@ -59,11 +60,5 @@ main() tot += foo->x; delete foo; } - if (tot != 4957) { - printf("test_List FAILED\n"); - exit(1); - } else { - printf("test_List PASSED\n"); - exit(0); - } + REQUIRE(tot == 4957); }