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:
authorStefan <29021710+Saalvage@users.noreply.github.com>2022-04-28 03:47:24 +0300
committerGitHub <noreply@github.com>2022-04-28 03:47:24 +0300
commite8ba771d4b4cf90cb99e011ef01059dd6533d39c (patch)
treef035dbd7d8e6f6e918a4da3182f5cb44f2890ac7 /scripts
parenteb8b04a2b1db23ea5665cd8b5cbe859beb0ef80d (diff)
Refactor stringification (#585)
* matcher-like nan check * Remove superfluous extern template declarations * Add explicit template parameters * Correct template instantiation * Fix test includes * class -> struct * Correctly instantiate * Oops * Try fix interface * Add MinGW exception * Add info regarding interface decl and def * Adjust docs * Remove accidental paste in comment * First draft * operator<< => StringStream (for now) * Forward declare cstr output operator * Remove unnecessary String constructor * Port more stuff to streams * Remove std::string stringification (it was broken anyways) * Remove anonymous namespace for the time being * Revert "Remove anonymous namespace for the time being" This reverts commit ec2819c44bdb647546108d29b135720083ded48c. * Move toStream to prevent disabling * Restore customization points * Remove superfluous const char* catcher * Merge branch 'dev' into fix-string * Better IsNaN stringification * Reset doctest * We're getting somewhere! * size_t -> unsigned long * Fix nullptr handling * Why is it selecting the template over the overload?? * Reduce template count * Forward declare cstr output operator (again) * Fix pointer stringification * Add flag that forces custom stringification methods to be provided (#595) * Add flag that forces custom stringification methods to be provided * Add docs * Add IsNaN operator! (#603) * Add IsNaN operator! * Docs * More concise impl * Optimized floating point stringification * Remove float stringification override * unsigned long -> size_t where appropriate * Automatic type stringification with optional overrides * Fix type stringification * Add manual short override to fix tests * Add tests * insertion fix? * Make operator<< static * Clean up fake type traits * Try fix stl warnings * Reintroduce deferred_false * Work around dumb VS15 shit * Oops * Yet another MSVS2015 workaround * Fix #618 * Doing ungodly things to make MSVS2015 work * Oops * rerun tests * Rerun tests * Fix #618 by removing string_view * Remove incorrect restrictions on <string> inclusion * Add String::EMPTY * Replace String::EMPTY with static EMPTY_STRING in order to avoid SIOF * Revert "Add String::EMPTY" This reverts commit 8856a220596398f27e11a031cedda352f067cbf8. Revert "Replace String::EMPTY with static EMPTY_STRING in order to avoid SIOF" This reverts commit 83d3c4f45dde09038d13e77379ea3b40843ce37f.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coverage_maxout.cpp55
1 files changed, 18 insertions, 37 deletions
diff --git a/scripts/coverage_maxout.cpp b/scripts/coverage_maxout.cpp
index 8b6e574f..ad55ef42 100644
--- a/scripts/coverage_maxout.cpp
+++ b/scripts/coverage_maxout.cpp
@@ -61,37 +61,19 @@ TEST_CASE("exercising tricky code paths of doctest") {
str += toString("aaa") //
+ toString(nullptr) //
+ toString(true) //
- + toString(static_cast<unsigned int>(0)) //
- + toString(0.5f) //
- + toString(0.5) //
- + toString(static_cast<long double>(0.1)) //
+ + toString(0u) //
+ toString('c') //
+ toString(static_cast<signed char>('c')) //
+ toString(static_cast<unsigned char>(1)) //
+ toString(static_cast<short>(1)) //
- + toString(static_cast<long>(1)) //
- + toString(static_cast<unsigned long>(1)) //
+ + toString(1L) //
+ + toString(1UL) //
+ toString(static_cast<unsigned short>(1)) //
- + toString(static_cast<long long>(1)) //
- + toString(static_cast<unsigned long long>(1));
+ + toString(1LL) //
+ + toString(1ULL);
std::ostringstream oss;
- // toStream
- detail::toStream(&oss, true);
- detail::toStream(&oss, 0.5f);
- detail::toStream(&oss, 0.5);
- detail::toStream(&oss, static_cast<long double>(0.1));
- detail::toStream(&oss, 'c');
- detail::toStream(&oss, static_cast<signed char>('c'));
- detail::toStream(&oss, static_cast<unsigned char>(1));
- detail::toStream(&oss, static_cast<short>(1));
- detail::toStream(&oss, static_cast<long>(1));
- detail::toStream(&oss, static_cast<unsigned long>(1));
- detail::toStream(&oss, static_cast<unsigned short>(1));
- detail::toStream(&oss, static_cast<long long>(1));
- detail::toStream(&oss, static_cast<unsigned long long>(1));
-
// trigger code path for String to ostream through operator<<
oss << str;
// trigger code path for assert string of a non-existent assert type
@@ -102,32 +84,31 @@ TEST_CASE("exercising tricky code paths of doctest") {
#endif
str += oss.str().c_str();
str += failureString(assertType::is_normal);
- CHECK(str == "omgomgomgaaaNULLtrue00.5f0.50.199991111111true0.50.50.1cc"
- "111111omgomgomgaaaNULLtrue00.5f0.50.199991111111");
+ CHECK(str == "omgomgomgaaanullptrtrue099991111111"
+ "omgomgomgaaanullptrtrue099991111111");
// trigger code path for rawMemoryToString
bool isThereAnything = str.size() > 0u;
- bool len_is_zero = detail::rawMemoryToString(isThereAnything).size() == 0u;
String unknown = toString(skip()); // trigger code path for "{?}"
str = unknown; // trigger code path for deleting memory in operator=
- CHECK_MESSAGE(len_is_zero, "should fail");
+ CHECK_FALSE_MESSAGE(isThereAnything, "should fail");
Approx a(5);
a.scale(4);
Approx b = a(7);
- CHECK(b == 5);
- CHECK(b != 5);
- CHECK(b > 5);
- CHECK(b < 5);
- CHECK(b >= 5);
- CHECK(b <= 5);
+ CHECK(b == 7);
+ CHECK(b != 6);
+ CHECK(b > 6);
+ CHECK(b < 8);
+ CHECK(b >= 7);
+ CHECK(b <= 7);
- CHECK(6 == a);
+ CHECK(5 == a);
CHECK(6 != a);
CHECK(6 > a);
- CHECK(6 < a);
- CHECK(6 >= a);
- CHECK(6 <= a);
+ CHECK(4 < a);
+ CHECK(5 >= a);
+ CHECK(5 <= a);
// trigger another single line of code... lol
auto oldVal = const_cast<ContextOptions*>(getContextOptions())->no_path_in_filenames;