This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new d0e5332 Test: Convert test_List.cc to Catch
d0e5332 is described below
commit d0e5332bc24468cb75f4d23fdd8e3bc96cf54fea
Author: Xavier Chi <[email protected]>
AuthorDate: Wed Sep 19 15:12:51 2018 -0500
Test: Convert test_List.cc to Catch
---
.gitignore | 1 -
src/tscore/Makefile.am | 4 ++--
src/tscore/{ => unit_tests}/test_List.cc | 13 ++++---------
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/.gitignore b/.gitignore
index ef6a007..d5b03d4 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 297b341..3d1fab3 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
@@ -238,7 +238,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@
@@ -268,6 +267,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 0407ed7..ad6dad0 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 @@ public:
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);
}