Commit Graph

3092 Commits

Author SHA1 Message Date
Martin Hořeňovský c582e351ce
Remove --list-test-names-only
People should use verbosity modifiers with `--list-tests` instead.

Closes #1190
2019-10-29 14:07:18 +01:00
Martin Hořeňovský d2cddfc9c5
Make --list-* exit code be 0
Previously it returned the sum of listed things because ???. This
was completely useless and in many ways actively counterproductive
because of the success/failure conventions around exit codes.

Closes #1410
2019-10-29 14:07:18 +01:00
Martin Hořeňovský 557b336125
Remove superfluous semicolon in the INFO macro
Closes #1456
2019-10-29 14:07:18 +01:00
Martin Hořeňovský 141761745a
Remove ANON_TEST_CASE
It can be fully replaced with `TEST_CASE` without any arguments,
so there is no need to keep it around.

Closes #1220
2019-10-29 14:07:18 +01:00
Martin Hořeňovský 3136c4fb6a
Refactored XMLWriter to provide finer-grained control over formatting 2019-10-29 13:59:18 +01:00
Martin Hořeňovský 74e0e737a6
Remove useless test 2019-10-29 11:44:24 +01:00
Martin Hořeňovský 0685216175
Mark type erasure in PredicateFunction as deprecated 2019-10-28 15:15:13 +01:00
Martin Hořeňovský fc320f6b8f
Extract FunctionReturnType to catch_meta.hpp 2019-10-28 15:15:13 +01:00
Martin Hořeňovský 5290d4bedc
Merge pull request #1791 from catchorg/dev-reorganize-warning-suppression
Rework how warning suppression in macros is done
2019-10-28 13:13:23 +01:00
Martin Hořeňovský 7ada02e21e
Avoid technically UB type punning when determining endianness 2019-10-27 22:07:10 +01:00
Martin Hořeňovský 849f2848bd
Rework how warning suppression in macros is done
Previously, each warning suppression was self-contained, with its
own pair of `SUPPRESS_X_WARNING` and `UNSUPPRESS_X_WARNING` macros.
This had the obvious advantage of being self-containing, but it
also meant that if we needed to suppress more than one warning
in a single place, then we would manipulate the compiler's warning
state multiple times, even though logically we would only need one
layer.

The new way of suppressing warnings in macros is to push compiler's
warning state with `CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` macro,
then disable whatever macros we need with the
`CATCH_INTERNAL_SUPPRESS_X_WARNINGS` macro, and then return to the
previous state using `CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION`.
2019-10-27 21:07:21 +01:00
Alexander Stein 2fbd66c51c Improve JUnit failure report
The JUnit report is improved in that:
* The message shows the testing condition, not the result
* The actual message has similar output than the console one
2019-10-27 18:02:14 +01:00
sp-dani-garcia 51b29ced1a Add SonarQube Generic Test Data reporter
It outputs reports in the `Generic Execution Test Data` format, see
https://docs.sonarqube.org/latest/analysis/generic-test/, specifically
https://docs.sonarqube.org/latest/analysis/generic-test/#header-2

Close #1738 (this is a cherry-pick and fixup of that PR)
2019-10-27 10:02:41 +01:00
Martin Hořeňovský 9a558171d8
Merge pull request #1776 from mvd4/bugfix/enable-floating-point-ranges
Enable floating point ranges
2019-10-27 09:17:15 +01:00
Martin Hořeňovský c5c688820c
Document that matcher combinators (&&, ||, !) do not take ownership
Closes #1781
2019-10-26 21:07:38 +02:00
Martin Hořeňovský 6a08225863
Add documentation for floating point `range` generator 2019-10-26 20:52:40 +02:00
Manuel Drews 4327baba40 Enable `range` generator for floating point types 2019-10-26 20:52:09 +02:00
Martin Hořeňovský 50cc14c94c
Rework StringRef interface and internals
Now it no longer tries to be this weird hybrid between an owning
and non-owning reference, and is only ever non-owning. This is also
reflected in its interface, for example `StringRef::isNullTerminated`
is now public, and `StringRef::c_str()` has the precondition that it
is true.

Overview of the changes:
* The `StringRef::m_data` member has been completely removed, as it
had no more uses.
* `StringRef::isSubstring()` has been made public and renamed to
`StringRef::isNullTerminated()`, so that the name reflects what the
method actually does.
* `StringRef::currentData()` has been renamed to `StringRef::data()`,
to be in line with common C++ containers and container-alikes.
* `StringRef::c_str()` will no longer silently make copies. It instead
has a precondition that `isNullTerminated()` is true.
* If the user needs a null-terminated string, they should use the
`std::string` conversion operator and call `c_str()` on the resulting
`std::string`.
* Some small optimizations in various places.
* Basic functionality is now `constexpr`.
2019-10-25 13:57:52 +02:00
Jozef Grajciar 87b745da66
v2.10.2 2019-10-24 18:41:25 +02:00
Martin Hořeňovský 7d0b205564
Prevent warning suppression from leaking when registering a listener 2019-10-22 00:10:01 +02:00
Martin Hostettler 8fb1219013 docs: command-line: Add example to specify tests by file name. 2019-10-21 23:51:33 +02:00
Martin Hořeňovský 23c80bcc92
Provide workaround for platforms where INFINITY is double
Fixes #1782
2019-10-21 18:33:26 +02:00
Martin Hořeňovský a2c8dce85c
v2.10.1 2019-10-20 21:03:22 +02:00
Martin Hořeňovský 1e379de9d7
Fix "ldd" -> "lld" typo in docs 2019-10-20 20:57:55 +02:00
Martin Hořeňovský 4eea438b73
Update updateWandbox script to account for the new Wandbox API response 2019-10-20 20:56:20 +02:00
Martin Hořeňovský 407ee0af2f
Add a section on slow linking under MinGW to "Known Limitations" docs
Unless someone steps up to fix the long link times with a set of
unobtrusive changes, the recommended solution will remain "use a better
linker".

Related to #1205, #1247, and #1637

Closes #1247
Closes #1637
2019-10-20 19:52:39 +02:00
Jonathan Vander Mey 060a41ec7b Suppress false positive from clang-analyzer
Fixes issue #1230
2019-10-20 17:27:09 +02:00
Martin Hořeňovský 90825a4f7a
Add more tests for reading test specs from file
Related to #1770
2019-10-20 15:14:50 +02:00
Martin Hořeňovský 9e8ae7d470
Use scientific notation for the WithinULP matcher
This should now properly handle small numbers which would previously
output something like `[0.00000000000000019, 0.00000000000000019]`,
which does not allow user to read the numbers properly.

Closes #1760
2019-10-20 12:30:21 +02:00
amitherman95 84856844e1 Fixes #1766: Catch terminates when parsing invalid test name 2019-10-19 21:14:06 +02:00
Martin Hořeňovský 01ef7076f5
Allow in-tree builds where Catch2 is just a subproject
Closes #1773
Closes #1774
2019-10-18 18:49:44 +02:00
Jozef Grajciar ae14a47360 TemplateTests: suppress -Wunused-template warning in template test cases
this warning was introduced by rework to support NTTPs
since we have implementation macro for NTTPs and normal template test cases
warning is going to be suppressed

Fixes #1762
2019-10-18 18:38:39 +02:00
Jozef Grajciar f2b23db6d1 TemplateTests: fix compilation with ICC
ICC in some cases fails on trailing return type with decltype

Closes #1748
2019-10-18 12:35:09 +02:00
Mertz, Arne 1aa98c76ac add a note how to run selftests using multiconfig generators 2019-10-17 20:23:51 +02:00
data-man 3195c242c2 Remove JSON library from users 2019-10-17 20:20:02 +02:00
Martin Hořeňovský 31906d83ec
Add parenthesis to prevent macro expansions of min/max
Closes #1772
2019-10-17 16:40:37 +02:00
Martin Hořeňovský 91fa55303b
Add test for including unguarded windows.h
If you do this, you are wrong, but apparently people expect libraries
to work around intrusive lower cased macros. Oh well.
2019-10-17 11:15:42 +02:00
Martin Hořeňovský 7c9f92bc1c
v2.10.0 2019-10-13 23:44:18 +02:00
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