Commit Graph

3104 Commits

Author SHA1 Message Date
Martin Hořeňovský a92a7d0229
Rewrite documentation for floating point matchers 2019-10-13 21:31:48 +02:00
Martin Hořeňovský e4d61e4cd8
Fix baselines 2019-10-13 21:26:51 +02:00
Martin Hořeňovský 9ba48e2c9b
Remove superfluous includes in exception matchers 2019-10-13 20:49:36 +02:00
Martin Hořeňovský 2cc0c71856
Add a matcher that checks exception's message
Only works for exceptions that publicly derive from `std::exception`
and the matching is done exactly, including case and whitespace.

Closes #1649
Closes #1728

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
#	modified:   ../docs/matchers.md
#	modified:   ../include/internal/catch_capture_matchers.h
#	modified:   ../projects/CMakeLists.txt
#	modified:   ../projects/SelfTest/Baselines/compact.sw.approved.txt
#	modified:   ../projects/SelfTest/Baselines/console.std.approved.txt
#	modified:   ../projects/SelfTest/Baselines/console.sw.approved.txt
#	modified:   ../projects/SelfTest/Baselines/junit.sw.approved.txt
#	modified:   ../projects/SelfTest/Baselines/xml.sw.approved.txt
#	modified:   ../projects/SelfTest/UsageTests/Matchers.tests.cpp
#
# Untracked files:
#	./
#	../clang-full/
#	../clang-test/
#	../clang10-build/
#	../coverage-build/
#	../gcc-build/
#	../gcc-full/
#	../include/internal/catch_matchers_exception.cpp
#	../include/internal/catch_matchers_exception.hpp
#	../misc-build/
#	../msvc-sln/
#	../notes.txt
#	../test-install/
#
2019-10-13 20:37:07 +02:00
Martin Hořeňovský 28663fb959
Use the right overload of std::nextafter in tests 2019-10-13 13:36:22 +02:00
Martin Hořeňovský d2d418a9cb
Add a Relative Comparison matcher for floating point numbers
It checks Knuth's _close enough with tolerance_ relationship, that
is `|lhs - rhs| <= epsilon * max(|lhs|, |rhs|)`, rather then the
_very close with tolerance_ relationship that can be written down as
`|lhs - rhs| <= epsilon * min(|lhs|, |rhs|)`.

This is because it is the more common model around the internet, and
as such is likely to be less surprising to the users. In the future
we might want to provide the other model as well.

Closes #1746
2019-10-13 11:56:50 +02:00
Martin Hořeňovský c8db4e77c4
Add a from_range(Container) overload to the generator helpers 2019-10-09 14:51:36 +02:00
Martin Hořeňovský 1c5749669e
Merge pull request #1769 from amitherman95/amitherman-1767
Patch:Failure to pass special chars through input file
2019-10-09 14:16:50 +02:00
Martin Hořeňovský 3109add95c
Add tests for the -f/--input-file command line argument 2019-10-09 12:54:13 +02:00
amitherman95 adb4789136 Patch:Failure to apply filters through external file 2019-10-09 11:43:06 +02:00
Martin Hořeňovský 75200e199e
Merge pull request #1768 from RT222/master
Simplified benchmark output with --benchmark-no-analysis
2019-10-08 21:07:35 +02:00
Martin Hořeňovský a5a22cdadb
Have the random generators use the global rng instance
This means that if you nest multiple random generators inside one
test case, they will not return the same sequence of numbers.

Idea taken from #1736 by Amit Herman.

Closes #1736
Closes #1734
2019-10-07 21:53:07 +02:00
Martin Hořeňovský 535da5c513
Introduce Catch's own RNG based on the PCG family of RNGs
In the future, we will also want to introduce our own
`uniform_int_distribution` and `uniform_real_distribution` to get
repeatable test runs across different platforms.
2019-10-07 19:56:23 +02:00
RT222 2331249a8d
Simplified benchmark output with --benchmark-no-analysis
Removed unused informations from benchmarks output when the --benchmark-no-analysis flag is used, making the results easier to read.
2019-10-07 15:40:00 +02:00
Martin Hořeňovský 319cb9e1da
Add a generator that takes an iterator pair 2019-10-06 13:55:10 +02:00
Martin Hořeňovský b8b765d55e
Merge pull request #1765 from kevingranade/patch-1
Add Cataclysm:Dark Days Ahead to project list
2019-10-06 12:41:46 +02:00
Kevin Granade a0ebd63806
Add Cataclysm:Dark Days Ahead to project list 2019-10-05 20:18:31 -07:00
Martin Hořeňovský 4bd2c3ad6a
Fix compilation error with CATCH_CONFIG_GLOBAL_NEXTAFTER
Wrong nesting of namespaces resulted in the `Catch` namespace
being ambigous between `::Catch` and `::{anon}::Catch` namespaces.
This should fix it.

Closes #1761
2019-10-05 21:03:46 +02:00
Martin Hořeňovský c38a5caa2e
Allow full range of target ULP values for the ULPMatcher
Previously it was limited to roughly 2 billion ULPs, rather than
the roughly 2^64 possible ones.
2019-10-05 13:38:22 +02:00
Martin Hořeňovský ebc5609484
Add test for INF == Approx(1) 2019-10-04 14:19:39 +02:00
Wim Leflere fcda35f645 update name of Value Generators in doc to match class names 2019-10-04 13:31:37 +02:00
Martin Hořeňovský 02ee130bd0
Special case Approx(inf) to better follow user expectations 2019-10-04 13:28:43 +02:00
Martin Hořeňovský 815f99541d
Do not explicitly install conan
Instead, let it be installed as a dependency of `conan-package-tools`
to avoid trouble with the fact that pip is really bad at version
resolution, and that up-to-date version of the `conan` package is not
supported by up-to-date version of the `conan-package-tools` package.
2019-10-03 00:00:17 +02:00
Martin Hořeňovský da0062f7c1
Merge pull request #1752 from amitherman95/amitherman-1737
Escape characters bug patch(v2.9.2)
2019-09-22 10:48:08 +02:00
Martin Hořeňovský de42f8a93e
Fix escaping of quotes in coverage helper 2019-09-21 23:19:45 +02:00
Martin Hořeňovský af84f1350e
Add documentation for the table generator helper 2019-09-21 01:00:53 +02:00
Martin Hořeňovský fc2066bf18
Add tests for escaping special characters in CLI 2019-09-21 00:50:17 +02:00
amitherman95 2bcff9dd35 Escape characters bug patch(v2.9.2) 2019-09-21 00:46:58 +02:00
Martin Hořeňovský 3beccfb429
Remove the no longer used is_unique type trait
It was used in checking that types in TEMPLATE_TEST_CASE and friends
were unique, but this was removed for v2.8.0 (#1628). Since there
are no further uses of this trait, the simplest thing to do is to
just remove it.

Fixes #1757
2019-09-20 23:28:19 +02:00
Martin Hořeňovský af8b2538a6
Ignore leading/trailing whitespace in test/section specs
The leading/trailing whitespace is problematic because of e.g.
`WHEN` macro having preceeding whitespace for alignment, and it is
generally messy.

Credits to Phil who did lot of the original work.

Closes #1708
2019-09-09 14:28:11 +02:00
Martin Hořeňovský a156440b19
Reinline some StringRef methods with trivial bodies 2019-09-08 21:08:37 +02:00
Martin Hořeňovský dab0296b64
Add test for past-the-end substr on StringRef 2019-09-08 21:07:21 +02:00
Martin Hořeňovský 9f4c4777a5
Remove (mostly) unused overloads of StringRef operator + 2019-09-08 21:01:33 +02:00
Martin Hořeňovský 293012a002
Inline SourceLineInfo::empty definition 2019-09-08 18:20:49 +02:00
Martin Hořeňovský e2b3443fe7
Do not blindly access empty StringRefs 2019-09-08 17:44:56 +02:00
Martin Hořeňovský 7b865daccc
Make StringRef's operator std::string explicit
This way it is explicit when there is a `StringRef` -> `std::string`
conversion and makes it easier to look for allocations that could
be avoided.

Doing this has already removed one allocation per registered test
case, as there was a completely pointless `StringRef` -> `std::string`
conversion when parsing tags of a test case.
2019-09-08 15:58:10 +02:00
Martin Hořeňovský 14362533bb
Check for empty expression properly
The old code was a left-over from the times when the
`capturedExpression` member was a `const char*`, which could always
be indexed. With the change to use `StringRef`, blindly indexing 0th
element is invalid, as it is not indexable part of a StringRef.
2019-09-08 14:35:01 +02:00
Matthias Moulin a5bb3e3d91 Small updates to include directives (#1726)
Fixed some inconsistencies in include directives.
2019-09-08 14:25:23 +02:00
Martin Hořeňovský 923db16322
Use StringRefs through the enum registration 2019-09-08 14:14:46 +02:00
Martin Hořeňovský fbbaadb704
Use StringRef literal for unknown enum values instead of string lit 2019-09-08 14:14:14 +02:00
Martin Hořeňovský dd1f0f1c72
Add test for --filename-as-tags 2019-09-07 20:43:14 +02:00
Martin Hořeňovský d27d580d0b
Add test for --libidentify command line flag 2019-09-07 20:36:12 +02:00
Martin Hořeňovský 6da00c1b64
Split out the rest of string manipulation tests 2019-09-07 20:22:36 +02:00
Martin Hořeňovský fe967b1f41
Remove the ill-considered StringRef::numberOfCharacters
It never counted characters, only codepoints. If you think these
are interchangeable, you should not touch non-ascii text.
2019-09-07 20:13:22 +02:00
Martin Hořeňovský f2c2711bdc
Add trim for StringRef 2019-09-07 11:31:00 +02:00
Martin Hořeňovský b77ab74b72
Start adding tests for string manip functions 2019-09-06 18:50:57 +02:00
Martin Hořeňovský 4038ee6bc6
Stop compilation if registering an enum could truncate its value
We probably want to use a bigger type (e.g. `int64_t`) later on,
but the is a mess right now anyway.
2019-09-06 18:36:59 +02:00
Martin Hořeňovský 789f3591ef
Do not write singular characters into stream as C-strings 2019-09-06 18:30:16 +02:00
Martin Hořeňovský 6e8d769775
Unify handling of __has_include checks 2019-09-06 13:38:58 +02:00
Martin Hořeňovský 1189a73be2
Do not assume that version placeholders contain ")" 2019-09-06 13:25:39 +02:00