Commit Graph

3500 Commits

Author SHA1 Message Date
Martin Hořeňovský
ab0ca2f566
Rename some matcher-related files
The two changes are
`catch_matchers_templates` -> `catch_matchers_templated` and
`catch_matchers_generic` -> `catch_matchers_predicate`. The former
is mostly cosmetic, but the second was previously significantly
misleading, and as the library is now to be consumed by including
specific headers, this needed to be fixed.
2020-03-27 10:24:08 +01:00
Martin Hořeňovský
3a3efebd16
Add IsEmpty and SizeIs matchers for ranges/containers
`SizeIs` can accept both `size_t` and a matcher. In the first case,
it checks whether the size of the range is equal to specified size.
In the second case, it checks whether the provided matcher accepts
the size of the range.
2020-03-27 10:24:08 +01:00
Martin Hořeňovský
f52a58e857
Make concrete matchers final
Outside of `MatcherBase` and `GenericMatcherBase`, matchers are not
designed to be overriden. This means that doing so can easily lead
to errors, and matchers are generally fairly simple functionality-wise.
so there is not much code reuse to be gained anyway.

Thus, Catch2-provided concrete matchers are now final.
2020-03-27 10:22:25 +01:00
Martin Hořeňovský
007efc173a
Add generic Contains matcher
It matches a range iff the range contains a specific element,
or an element in the range matches the provided matcher.
2020-03-27 10:22:25 +01:00
Martin Hořeňovský
89e857349b
Use _t form of traits 2020-03-27 10:22:25 +01:00
Martin Hořeňovský
c2daf468bb
Standardize matcher headers to use .hpp suffix 2020-03-27 10:22:25 +01:00
Martin Hořeňovský
64d7f9b98a
New and hopefully improved documentation for matchers 2020-03-27 10:22:25 +01:00
Martin Hořeňovský
121f04ffcf
Update Catch2-provided pkg-config
Also fixes an installation issue, where some installation steps
would not properly pick up `CMAKE_INSTALL_PREFIX` when set.
2020-03-18 10:51:35 +01:00
Martin Hořeňovský
0e7e6b210a
Remove obsolete surrogate TUs
They will be returned later, but better organized and covering
_all_ headers.
2020-03-17 23:34:55 +01:00
Martin Hořeňovský
a15ffb735d
Make ListeningReporter final
In general, for Catch2 v3 we are making virtual types `final`,
unless they were explicitly designed to be derived-from.
`ListeningReporter` is definitely not designed to be derived-from.
2020-03-09 21:15:30 +01:00
Martin Hořeňovský
727b26ab35
Remove IStreamingReporter::isMulti query
This was previously used to avoid `dynamic_cast` inside our code,
when we were creating more than one reporter, or a reporter
together with listeners. However, since then the offending code
was refactored to be smarter instead, and this query member function
is no longer needed nor used.
2020-03-09 21:07:32 +01:00
Martin Hořeňovský
9de6eae6bb
ConsoleReporter no longer creates a string when writing time units
This is minor perf improvement only, but it is free and trivial.
2020-03-08 14:04:35 +01:00
Martin Hořeňovský
d1ffaf55a1
Fix warnings in ExtraTests and Examples 2020-02-26 16:07:54 +01:00
Martin Hořeňovský
33b47f7309
Fix warnings from stringifying functions
The only way to stream those is to use the `bool` overload of `op<<`.
However, to convert a function to bool, GCC creates AST equivalent
of `A? true : false`. Then, because `A` is a function, it warns that
it will never be `false`. 🤦

As a bonus, newer GCC versions issue _two_ different warnings about
this, but older GCC versions do not know both of them, so we also
have to suppress warning about unknown warning suppression.
2020-02-26 16:07:41 +01:00
Martin Hořeňovský
8d1e7ca896
Suppress unused variable warning for template test cases
The variable initialization has test registration as a side-effect,
but as far as GCC is concerned, the variable itself is unused.
Because the macro substitution always happens at global scope, we
cannot use cast to `void` as is usually done.
2020-02-26 16:07:39 +01:00
Martin Hořeňovský
e601a5dc4f
Suppress empty-variadic macros warning under GCC 2020-02-26 16:07:36 +01:00
Martin Hořeňovský
e9caeb7d0b
Fix Wparentheses for GCC
Sadly most versions still cannot properly handle the suppression
via `_Pragma`, so it has to leak to the users when they use older
GCC versions to compile their code
2020-02-26 16:07:34 +01:00
Martin Hořeňovský
6e270958a2
Add development build option to CMake and enable it on CI
Development build enables warnings and and `Werror` or equivalent.
2020-02-26 16:07:26 +01:00
Martin Hořeňovský
50b2cfa5de
Fix -Wmissing-braces in new matchers 2020-02-21 23:10:34 +01:00
Martin Hořeňovský
34e7a5e0cf
Bunch of warning fixes 2020-02-21 23:10:22 +01:00
Martin Hořeňovský
04f18d996b
Suppress global constructor warning in benchmarking 2020-02-21 23:10:12 +01:00
Martin Hořeňovský
3bb9fcd916
Remove trailing semi in REGISTER_TEST_CASE 2020-02-21 23:10:01 +01:00
Martin Hořeňovský
c3013a6251
Move matcher implementation to their own subfolder
In the future we can expect many more matchers, so let's give them
a place to live.

Also moved matcher-related internal files to `internal` subfolder.
Ideally we should sort out all of our source code, but that will
have to come later.
2020-02-20 17:42:11 +01:00
Martin Hořeňovský
40e35d4318
Reorganize base headers for matchers 2020-02-20 13:39:04 +01:00
Martin Hořeňovský
b83a12b12c
Replace enable_if with enable_if_t 2020-02-20 13:03:38 +01:00
Martin Hořeňovský
d33af93e17
Cleanup visibility in generic not matcher 2020-02-20 13:03:36 +01:00
Martin Hořeňovský
25c5ae240c
Disable copies on generic matcher combinators 2020-02-20 13:03:34 +01:00
Martin Hořeňovský
260263b9bf
Combined matchers are now final 2020-02-20 13:03:32 +01:00
Martin Hořeňovský
cf6575576f
Start fixing up Matchers: namespaces, composition ops
This commit also forbids composing lvalues of composed matchers, as
per previous deprecation notice. I do not expect this to be contentious
in practice, because there was a bug in that usage for years, and
nobody complained.
2020-02-20 13:03:30 +01:00
Martin Hořeňovský
a1be19aa1b
Remove the separately compiled test for Benchmarking Macros
Thanks to the changes to compilation model, the tests for benchmarking
macros have been made part of the normal test run. This means that
the only purpose these separately compiled tests served was to waste
CI time.
2020-02-18 13:48:34 +01:00
Martin Hořeňovský
c745adb81c
Temporarily disable the test for DebugBreakMacro
The change to static library means that the new implementation needs
to be somewhat different, and I do not want to fix it right now.
2020-02-18 13:43:37 +01:00
Martin Hořeňovský
06c135706e
Move X12-CustomDebugBreakMacro.cpp to the right place
This is a small fixup because cherry-picking the relevant commit
threw it into the wrong place...
2020-02-18 10:20:37 +01:00
Martin Hořeňovský
ae1d21315c
Specialize CATCH_TRAP() for iOS + thumb instruction set combo
Fixes #1862
2020-02-16 16:11:29 +01:00
Tristan Stenner
6a2c025bfc
Add command line option 'never' to --wait-for-keypress (#1866)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-16 16:11:11 +01:00
offa
2441c2faab
stdio.h replaced with cstdio. 2020-02-16 16:05:30 +01:00
Clare Macrae
442283ee11
Add link to list of commercial user projects 2020-02-16 16:05:18 +01:00
Clare Macrae
3f81dd753a
Fix typo in link in docs 2020-02-16 16:05:08 +01:00
Martin Hořeňovský
f8794634c2
Fix significant bug with storing composed matchers
Given that in the 2 or so years that matchers are thing nobody complained,
it seems that people do not actually write this sort of code, and the
possibility will be removed in v3. However, to avoid correctness bugs,
we will have to support this weird code in v2.
2020-02-16 16:02:31 +01:00
Martin Hořeňovský
d6b2a3793b
Check for Windows instead of WIN32 for wmain entry point
Closes #1849
2020-02-16 15:54:24 +01:00
Martin Hořeňovský
548de655fd
Cleanup nextafter workaround 2020-02-16 15:52:14 +01:00
Martin Hořeňovský
89f18f15ca
Add a test for custom debug break macros
See #1846
2020-02-16 15:47:00 +01:00
khyperia
3c7e737a7b
Allow configuring of benchmark warmup time 2020-02-16 15:44:23 +01:00
khyperia
e880da93bd
Make CATCH_BREAK_INTO_DEBUGGER be user-configurable 2020-02-16 15:27:21 +01:00
Rosen Penev
3e01d4b239
catch_compiler_capabilities.h: use proper math define
C++11 math requires _GLIBCXX_USE_C99_MATH_TR1 to be true with gcc/clang.

Also fixes an issue with uClibc-ng where __UCLIBC__ is defined in features.h but
that is not included here and is thus no-op.
2020-02-16 15:27:04 +01:00
offa
06c32862b3
Some refactorings:
- Overrides added
 - usages of push_back() replaced with emplace_back()
 - Loop variable made const-refernce
 - NULL replaced with nullptr
 - Names used in the declaration and definition unified
 - size() replaced with empty
 - Identical cases merged
2020-02-16 15:25:23 +01:00
Daniel Griscom
ab520f4e97
Removed unneeded 'using uchar = unsigned char' 2020-02-16 15:12:07 +01:00
Martin Hořeňovský
32617f42d0
Cherry-pick release notes for v2.11.1 2020-02-16 15:11:30 +01:00
melak47
17c4b2d093
Feature: generic matchers (#1843)
This commit extends the Matchers feature with the ability to have type-independent (e.g. templated) matchers. This is done by adding a new base type that Matchers can extend, `MatcherGenericBase`, and overloads of operators `!`, `&&` and `||` that handle matchers extending `MatcherGenericBase` in a special manner.

These new matchers can also take their arguments as values and non-const references.

Closes #1307 
Closes #1553 
Closes #1554 

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-16 11:19:10 +01:00
Martin Hořeňovský
db1a0465dc
Outline GeneratorException from generators header 2020-02-14 16:15:47 +01:00
Martin Hořeňovský
b2a6523d85
Fix Clang-3.8 compilation of tests
As far as I know, the compilation error is a compiler bug, but I
do not want to just drop the support for something that is trivial
to work around.
2020-02-13 16:57:37 +01:00