fixed name of argument for sorting
diff --git a/doc/markdown/main.md b/doc/markdown/main.md
index c7e8e7e..6b5ce22 100644
--- a/doc/markdown/main.md
+++ b/doc/markdown/main.md
@@ -18,12 +18,14 @@
#include "doctest.h"
int main(int argc, char** argv) {
- doctest::Context context; // initialize
+ doctest::Context context;
+
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
// defaults
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in their name
context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
- context.setOption("sort", "name"); // sort the test cases by their name
+ context.setOption("order_by", "name"); // sort the test cases by their name
context.applyCommandLine(argc, argv);
diff --git a/doctest/doctest.h b/doctest/doctest.h
index f04f723..c97e32a 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -3221,9 +3221,12 @@
const TestData* lhs = *static_cast<TestData* const*>(a);
const TestData* rhs = *static_cast<TestData* const*>(b);
- int res = strcmp(lhs->m_name, rhs->m_name);
- if(res != 0)
- return res;
+ int res_name = strcmp(lhs->m_name, rhs->m_name);
+ if(res_name != 0)
+ return res_name;
+ int res_type_name = strcmp(lhs->m_type_name, rhs->m_type_name);
+ if(res_type_name != 0)
+ return res_type_name;
return suiteOrderComparator(a, b);
}
diff --git a/doctest/parts/doctest_impl.h b/doctest/parts/doctest_impl.h
index acf5449..2a8a439 100644
--- a/doctest/parts/doctest_impl.h
+++ b/doctest/parts/doctest_impl.h
@@ -814,9 +814,12 @@
const TestData* lhs = *static_cast<TestData* const*>(a);
const TestData* rhs = *static_cast<TestData* const*>(b);
- int res = strcmp(lhs->m_name, rhs->m_name);
- if(res != 0)
- return res;
+ int res_name = strcmp(lhs->m_name, rhs->m_name);
+ if(res_name != 0)
+ return res_name;
+ int res_type_name = strcmp(lhs->m_type_name, rhs->m_type_name);
+ if(res_type_name != 0)
+ return res_type_name;
return suiteOrderComparator(a, b);
}
diff --git a/examples/disabled/main.cpp b/examples/disabled/main.cpp
index 5fcfe79..1ec0723 100644
--- a/examples/disabled/main.cpp
+++ b/examples/disabled/main.cpp
@@ -14,7 +14,9 @@
// set an exception translator for int
doctest::registerExceptionTranslator(intTranslator);
- doctest::Context context; // initialize
+ doctest::Context context;
+
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
// defaults
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name
@@ -23,8 +25,8 @@
context.applyCommandLine(argc, argv);
// overrides
- context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
- context.setOption("sort", "name"); // sort the test cases by their name
+ context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
+ context.setOption("order_by", "name"); // sort the test cases by their name
int res = context.run(); // run
diff --git a/examples/multi_file_example/main.cpp b/examples/multi_file_example/main.cpp
index 227ce21..5ecfab6 100644
--- a/examples/multi_file_example/main.cpp
+++ b/examples/multi_file_example/main.cpp
@@ -2,7 +2,9 @@
#include "doctest.h"
int main(int argc, char** argv) {
- doctest::Context context; // initialize
+ doctest::Context context;
+
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
// defaults
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in their name
@@ -11,8 +13,8 @@
context.applyCommandLine(argc, argv);
// overrides
- context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
- context.setOption("sort", "name"); // sort the test cases by their name
+ context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
+ context.setOption("order_by", "name"); // sort the test cases by their name
int res = context.run(); // run
diff --git a/examples/separate_headers/main.cpp b/examples/separate_headers/main.cpp
index 7979a06..68c0799 100644
--- a/examples/separate_headers/main.cpp
+++ b/examples/separate_headers/main.cpp
@@ -1,7 +1,9 @@
#include "parts/doctest_impl.h"
int main(int argc, char** argv) {
- doctest::Context context; // initialize
+ doctest::Context context;
+
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
// defaults
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name
@@ -10,7 +12,7 @@
context.applyCommandLine(argc, argv);
// overrides
- context.setOption("sort", "name"); // sort the test cases by their name
+ context.setOption("order_by", "name"); // sort the test cases by their name
int res = context.run(); // run
diff --git a/examples/separate_headers/test.cpp b/examples/separate_headers/test.cpp
index a47b51f..f2a5584 100644
--- a/examples/separate_headers/test.cpp
+++ b/examples/separate_headers/test.cpp
@@ -255,7 +255,7 @@
TypePair<char, int>
>::Result pairs;
-TYPE_TO_STRING(TypePair<char, int>)
+//TYPE_TO_STRING(TypePair<char, int>)
TEST_CASE_TEMPLATE("trololo", T, pairs) {
CHECK(sizeof(typename T::A) == static_cast<unsigned>(4));
@@ -266,17 +266,18 @@
}
TEST_CASE_TEMPLATE_DEFINE("separate", T, it) {
- T a = T();
- ++a;
- SUBCASE("root") {
- ++a;
- SUBCASE("1") {
- CHECK(doctest::Approx(a) == T());
- }
- SUBCASE("2") {
- CHECK(doctest::Approx(a) == T());
- }
- }
+ MESSAGE("aaa");
+ //T a = T();
+ //++a;
+ //SUBCASE("root") {
+ // ++a;
+ // SUBCASE("1") {
+ // CHECK(doctest::Approx(a) == T());
+ // }
+ // SUBCASE("2") {
+ // CHECK(doctest::Approx(a) == T());
+ // }
+ //}
}
TEST_CASE_TEMPLATE_INSTANTIATE(it, the_types)
diff --git a/examples/user_supplied_main/main.cpp b/examples/user_supplied_main/main.cpp
index 8354952..51a46ee 100644
--- a/examples/user_supplied_main/main.cpp
+++ b/examples/user_supplied_main/main.cpp
@@ -4,12 +4,14 @@
int program();
int main(int argc, char** argv) {
- doctest::Context context; // initialize
+ doctest::Context context;
+
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
// defaults
context.addFilter("test-case-exclude", "*math*"); // exclude test cases with "math" in the name
- context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
- context.setOption("sort", "name"); // sort the test cases by their name
+ context.setOption("abort-after", 5); // stop test execution after 5 failed assertions
+ context.setOption("order_by", "name"); // sort the test cases by their name
context.applyCommandLine(argc, argv);
diff --git a/scripts/code_coverage_source/main.cpp b/scripts/code_coverage_source/main.cpp
index 048c246..9ece142 100644
--- a/scripts/code_coverage_source/main.cpp
+++ b/scripts/code_coverage_source/main.cpp
@@ -56,7 +56,7 @@
context.addFilter("test-case-exclude", "*math*");
context.setOption("no-breaks", true);
- context.setOption("sort", "name");
+ context.setOption("order_by", "name");
context.applyCommandLine(argc, argv);
diff --git a/scripts/data/article.txt b/scripts/data/article.txt
index caa5c53..97026f8 100644
--- a/scripts/data/article.txt
+++ b/scripts/data/article.txt
@@ -98,6 +98,7 @@
#include "doctest.h"
int main(int argc, char** argv) {
doctest::Context ctx;
+ // !!! THIS IS JUST AN EXAMPLE SHOWING HOW DEFAULTS/OVERRIDES ARE SET !!!
ctx.setOption("abort-after", 5); // default - stop after 5 failed asserts
ctx.applyCommandLine(argc, argv); // apply command line - argc / argv
ctx.setOption("no-breaks", true); // override - don't break in the debugger
diff --git a/scripts/random_dev_notes.md b/scripts/random_dev_notes.md
index c605ecb..3f58eaf 100644
--- a/scripts/random_dev_notes.md
+++ b/scripts/random_dev_notes.md
@@ -4,7 +4,8 @@
type-parameterized tests
- test with subcase/info
- test with disabled
-- test with sorting - shouldn't the type be a part of the name? heap alloc? :(
+- test with sorting - shouldn't the type be a part of the name?
+- test in header
rework console reporter - print test case name in the separator (but that will break the BDD macros!)
@@ -15,11 +16,6 @@
look at boost test again:
http://www.boost.org/doc/libs/1_63_0/libs/test/doc/html/index.html
-note in all custom mains with a comment that the defaults/overrides are just an example and users shouldn't just copy/paste them!
-
-
-Nothing is better than documentation with examples. Nothing is worse than examples that don't actually work, because the code has changed since the documentation has been (was) written.
-
try if there are warnings for unused variables when tests are disabled
@@ -65,8 +61,10 @@
- git fetch origin pull/ID/head:BRANCHNAME
== other
-- compilation errors with operator<< - happens with doctest - in case it comes up... https://github.com/philsquared/Catch/issues/757
-- operator<< trouble - https://github.com/philsquared/Catch/issues/872
+- operator<< trouble
+ - https://github.com/philsquared/Catch/issues/757
+ - https://github.com/philsquared/Catch/issues/872
+ - https://github.com/philsquared/Catch/pull/877
- toString trouble - https://github.com/philsquared/Catch/issues/741
- I suspect -Wsign-compare is not being silenced by the pragmas...