Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/onqtam/doctest.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronqtam <vik.kirilov@gmail.com>2017-05-03 06:26:29 +0300
committeronqtam <vik.kirilov@gmail.com>2017-05-16 00:22:23 +0300
commitc4efc482cde6cabfeb9194774a32f7b2faadbd63 (patch)
tree369be2980619ece4ee43a80ffd73d98d5cfe1f33
parent14ddb1e997e6df58e22075f5e9044e9a1c0ac945 (diff)
maxed out code coverage
-rw-r--r--examples/all_features/CMakeLists.txt3
-rw-r--r--examples/all_features/coverage_maxout.cpp20
-rw-r--r--examples/all_features/test_output/abort_after.txt2
-rw-r--r--examples/all_features/test_output/coverage_maxout.cpp.txt5
-rw-r--r--examples/all_features/test_output/filter_2.txt3
-rw-r--r--examples/all_features/test_output/first_last.txt3
-rw-r--r--examples/all_features/test_output/list_test_suites.txt3
-rw-r--r--examples/all_features/test_output/version.txt1
8 files changed, 25 insertions, 15 deletions
diff --git a/examples/all_features/CMakeLists.txt b/examples/all_features/CMakeLists.txt
index b65f0c73..7c2be054 100644
--- a/examples/all_features/CMakeLists.txt
+++ b/examples/all_features/CMakeLists.txt
@@ -34,7 +34,6 @@ foreach(f ${files})
endforeach()
# queries
-doctest_add_test(NAME version COMMAND $<TARGET_FILE:${PROJECT_NAME}> -v)
doctest_add_test(NAME help ${common_args} -h)
doctest_add_test(NAME count ${common_args} -c -sf=*coverage*)
doctest_add_test(NAME list_test_cases ${common_args} -ltc -sf=*coverage*)
@@ -45,7 +44,7 @@ doctest_add_test(NAME all_binary ${common_args} -tc=all?binary* -s) # print all
doctest_add_test(NAME abort_after ${common_args} -aa=2 -e=off -sf=*coverage*) # abort after 2 assert fails and parse a negative
doctest_add_test(NAME first_last ${common_args} -f=2 -l=4 -sf=*coverage*) # run a range
doctest_add_test(NAME filter_1 ${common_args} -ts=none) # should filter out all
-doctest_add_test(NAME filter_2 ${common_args} -tse=*) # should filter out all
+doctest_add_test(NAME filter_2 COMMAND $<TARGET_FILE:${PROJECT_NAME}> -tse=*) # should filter out all + print skipped/version
doctest_add_test(NAME filter_3 ${common_args} -sc=from*,sc* -sce=sc2 -sf=*subcases*) # enter a specific subcase - sc1
doctest_add_test(NAME order_1 ${common_args} -ob=suite -sf=*test_cases_and_suites*)
doctest_add_test(NAME order_2 ${common_args} -ob=name -sf=*test_cases_and_suites*)
diff --git a/examples/all_features/coverage_maxout.cpp b/examples/all_features/coverage_maxout.cpp
index 6b5a9e67..4f472707 100644
--- a/examples/all_features/coverage_maxout.cpp
+++ b/examples/all_features/coverage_maxout.cpp
@@ -29,6 +29,8 @@ TEST_CASE("doctest internals") {
// trigger code path for comparing the file in "operator<" of SubcaseSignature
CHECK(detail::SubcaseSignature("", "a.cpp", 0) < detail::SubcaseSignature("", "b.cpp", 0));
+ // same for String
+ CHECK(String("a.cpp") < String("b.cpp"));
// trigger code path for string with nullptr
String a(static_cast<const char*>(doctest::detail::getNull()));
@@ -69,16 +71,18 @@ TEST_CASE("doctest internals") {
CHECK_MESSAGE(len_is_zero, "should fail");
}
-TEST_CASE("will end from a std::string exception") {
- throw_if(true, std::string("std::string!"));
-}
+TEST_SUITE("exception related") {
+ TEST_CASE("will end from a std::string exception") {
+ throw_if(true, std::string("std::string!"));
+ }
-TEST_CASE("will end from a const char* exception") {
- throw_if(true, "const char*!");
-}
+ TEST_CASE("will end from a const char* exception") {
+ throw_if(true, "const char*!");
+ }
-TEST_CASE("will end from an unknown exception") {
- throw_if(true, doctest::String("unknown :("));
+ TEST_CASE("will end from an unknown exception") {
+ throw_if(true, doctest::String("unknown :("));
+ }
}
#endif // DOCTEST_CONFIG_DISABLE
diff --git a/examples/all_features/test_output/abort_after.txt b/examples/all_features/test_output/abort_after.txt
index 08f99203..3a86876f 100644
--- a/examples/all_features/test_output/abort_after.txt
+++ b/examples/all_features/test_output/abort_after.txt
@@ -20,5 +20,5 @@ with context:
Aborting - too many failed asserts!
===============================================================================
[doctest] test cases: 1 | 0 passed | 1 failed |
-[doctest] assertions: 5 | 3 passed | 2 failed |
+[doctest] assertions: 6 | 4 passed | 2 failed |
Program code.
diff --git a/examples/all_features/test_output/coverage_maxout.cpp.txt b/examples/all_features/test_output/coverage_maxout.cpp.txt
index 45fca143..1ecf30cb 100644
--- a/examples/all_features/test_output/coverage_maxout.cpp.txt
+++ b/examples/all_features/test_output/coverage_maxout.cpp.txt
@@ -26,6 +26,7 @@ with context:
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from a std::string exception
TEST CASE FAILED!
@@ -34,6 +35,7 @@ threw exception:
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from a const char* exception
TEST CASE FAILED!
@@ -42,6 +44,7 @@ threw exception:
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from an unknown exception
TEST CASE FAILED!
@@ -50,5 +53,5 @@ threw exception:
===============================================================================
[doctest] test cases: 4 | 0 passed | 4 failed |
-[doctest] assertions: 6 | 3 passed | 3 failed |
+[doctest] assertions: 7 | 4 passed | 3 failed |
Program code.
diff --git a/examples/all_features/test_output/filter_2.txt b/examples/all_features/test_output/filter_2.txt
index eca69f05..bdf37adb 100644
--- a/examples/all_features/test_output/filter_2.txt
+++ b/examples/all_features/test_output/filter_2.txt
@@ -1,5 +1,6 @@
+[doctest] doctest version is "1.1.4"
[doctest] run with "--help" for options
===============================================================================
-[doctest] test cases: 0 | 0 passed | 0 failed |
+[doctest] test cases: 0 | 0 passed | 0 failed | 62 skipped
[doctest] assertions: 0 | 0 passed | 0 failed |
Program code.
diff --git a/examples/all_features/test_output/first_last.txt b/examples/all_features/test_output/first_last.txt
index e0df6f72..5f64c78e 100644
--- a/examples/all_features/test_output/first_last.txt
+++ b/examples/all_features/test_output/first_last.txt
@@ -1,6 +1,7 @@
[doctest] run with "--help" for options
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from a std::string exception
TEST CASE FAILED!
@@ -9,6 +10,7 @@ threw exception:
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from a const char* exception
TEST CASE FAILED!
@@ -17,6 +19,7 @@ threw exception:
===============================================================================
coverage_maxout.cpp(0)
+TEST SUITE: exception related
TEST CASE: will end from an unknown exception
TEST CASE FAILED!
diff --git a/examples/all_features/test_output/list_test_suites.txt b/examples/all_features/test_output/list_test_suites.txt
index 779fe6fa..cbe0043d 100644
--- a/examples/all_features/test_output/list_test_suites.txt
+++ b/examples/all_features/test_output/list_test_suites.txt
@@ -1,6 +1,7 @@
[doctest] run with "--help" for options
[doctest] listing all test suites
===============================================================================
+exception related
===============================================================================
[doctest] number of test cases passing the current filters: 4
-[doctest] number of test suites with test cases passing the current filters: 0
+[doctest] number of test suites with test cases passing the current filters: 1
diff --git a/examples/all_features/test_output/version.txt b/examples/all_features/test_output/version.txt
deleted file mode 100644
index 12266d49..00000000
--- a/examples/all_features/test_output/version.txt
+++ /dev/null
@@ -1 +0,0 @@
-[doctest] doctest version is "1.1.4"