Commit Graph

1583 Commits

Author SHA1 Message Date
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 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
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ý
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
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
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ý
7c9f92bc1c
v2.10.0 2019-10-13 23:44:18 +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ý
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
amitherman95
adb4789136 Patch:Failure to apply filters through external file 2019-10-09 11:43:06 +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
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ý
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
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
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ý
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ý
d27d580d0b
Add test for --libidentify command line flag 2019-09-07 20:36:12 +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ý
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ý
6e8d769775
Unify handling of __has_include checks 2019-09-06 13:38:58 +02:00
Martin Hořeňovský
addf799040
Workaround missing std::nextafter in uClibc
Luckily, the rest of C++11 features seem to be supported...

Closes #1739
2019-09-06 13:08:44 +02:00
Martin Hořeňovský
155274f0df
Add disabling the use of Android's logging at compile time
This is done via the new compile time toggle,
`CATCH_CONFIG_ANDROID_LOGWRITE`.

Closes #1743
2019-09-06 12:44:06 +02:00
Benjamin Worpitz
18d597cf10 Allow to use non-copyable and non-movable types in TEMPLATE_LIST_TEST_CASE
The parameter given to `convert` may not be copyable therefore it has to be
captured by const reference. For example an `std::tuple` that contains a
non-copyable type is itself non-copyable.

The NonDefaultConstructible test-case was reduced by one example type
because it did not add any value.
2019-09-06 12:15:09 +02:00
Martin Hořeňovský
46a70071a7
Use __android_log_write instead of __android_log_print
`print` version of the logging functions supports `printf`-like
formatting, which we do not use and given our current debug print
internals, will never use. This should be slightly more efficient
and expresses the intent better.
2019-08-10 14:51:38 +02:00
Jesse Alas
378cc1a670 Rename template parameter names to avoid name conflict on Solaris.
Closes #1722
2019-08-10 10:55:17 +02:00
Martin Hořeňovský
738818ae1d
Add a test for the internals 2019-08-09 10:50:53 +02:00
Martin Hořeňovský
2c869e17e4
v2.9.2 2019-08-08 14:05:24 +02:00
Martin Hořeňovský
0ab11aa9b4
(Hopefully) Fix Obj-C++ compilation of matchers
Thanks to bdb for the patch, related to #1661
2019-08-07 20:35:27 +02:00
Axel Huebl
820b1f12bf
static constexpr: storage class first
Seen with PGI compiler for `static constexpr`:
```
warning: storage class is not first
```
2019-08-06 19:17:16 -05:00
Steven Franzen
6070745cab Improve reporting of unmatched filters (#1684)
This PR ultimately does 3 things
* Separately tracks matched tests per each filter part (that is, a set of filters separated by an OR (`,`)), which allows Catch2 to report each of the alternative filters that don't match any tests.
* Fixes `-w NoTests` to return non-zero in the process
* Adds tests for `-w NoTests`.
2019-08-06 20:51:19 +02:00
Martin Hořeňovský
cf55cfd76f
Tiny speedup when listing tags
Noticed that the code was originally concatenating strings just to
then append the result to another string. Now it does not create
temporaries and also preallocates the string buffer.
2019-08-05 19:12:29 +02:00
Mike Cowan
e5c0e3322d Add Android implementation of writeToDebugConsole that prints to Logcat (#1710) 2019-07-31 23:12:34 +02:00
Martin Hořeňovský
ba9193370b
Add autoconfiguration for RTX
Closes #1693
2019-07-30 11:28:28 +02:00
Benjamin Worpitz
e7c26f09d1 Fix non-default-constructible type lists used in TEMPLATE_LIST_TEST_CASE (#1697)
* Fix non-default-constructible type lists used in TEMPLATE_LIST_TEST_CASE

std::tuple is not default constructible when the first type is not
default-constuctible. Therefore it can not be instantiated.
to circumvent this, we have to use std::declval in the unevaluate decltype
context.
2019-07-22 12:56:33 +02:00
Martin Hořeňovský
53281b471f
Prevent compilation of generators that use bool in dangerous manner
Closes #1692
2019-07-18 11:54:18 +02:00
Stuart Dootson
87739ad3fe Add std::byte stringification support (#1686)
* Add `std::byte` support

1. Add byte detection in Catch config
2. Add a `std::byte`specialisation for Catch2::Detail::StringMaker
2019-07-13 14:47:56 +02:00
Martin Hořeňovský
11488e63b6
Use _WIN32 macro for detecting MSVC Windows
Previously we used `WIN32`, which sometimes does exist, but according to
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
`_WIN32` is the one that is actually provided by the compiler.

Closes #1676.
2019-07-06 16:55:10 +02:00
Martin Hořeňovský
c0d3a2e08f
Merge pull request #1672 from sommd/master
Fix ChunkGenerator with chunk-size 0
2019-07-01 18:07:37 +02:00
Steven Franzen
800f1b1d3d
Fix TrackerBase::close children completion check
Now verifies that all children have completed, instead of only the last.
2019-06-29 18:02:28 +02:00
David Sommerich
9cf5897a11 Fix ChunkGenerator with chunk-size 0
Fixes #1671
2019-06-29 23:48:30 +10:00
Martin Hořeňovský
2f631bb808
v2.9.1 2019-06-17 12:02:14 +02:00
Martin Hořeňovský
f9dce28e7d
v2.9.0 2019-06-16 10:42:59 +02:00
geh
bbbd5c4e08 Added null-ptr check in Colour::use() 2019-06-15 18:06:59 +02:00
Jozef Grajciar
f2cfc2b852 TEMPLATE_LIST_TEST_CASE implementation
Closes #1627
2019-06-15 15:40:39 +02:00
Martin Hořeňovský
c365ac392b
Standardize and document the parallel processing toggle 2019-06-15 12:50:36 +02:00
Martin Hořeňovský
e640c3837a
Move the async-using parts of benchmarking into a .cpp file
This keeps it out of the main include path when benchmarking is
enabled, somewhat reducing the compilation-time penalty.

Also moved some other functions into the .cpp file, especially
helpers that could be given internal linkage, and concretized some
iterator-templated code that only ever used
`std::vector<double>::iterator`.
2019-06-15 11:43:25 +02:00
Martin Hořeňovský
7142d5a8c9
Show bound when stringifying the WithinULP matcher
Closes #1581
2019-06-15 07:12:27 +02:00
Martin Hořeňovský
1967feac49
Introduce stubs for throwing specific exception types
This allows us to move <stdexcept> out of the common path, and replace
it with just <exception>. The difference between these two headers is
~13k lines after preprocessing on libstdc++ (16k vs 3k) and ~17k lines
for MS's STL(33k vs 16k).

Note that this is only beneficial if no other stdlib header we use
includes <stdexcept>. AFAIK this is true for the newest MS's STL,
but I have no idea of the applicability for libstdc++ and libc++.
2019-06-14 19:13:50 +02:00
Martin Hořeňovský
e340ab8db6
Various improvements to the benchmarking support
* Units from <ratio> are no longer redeclared in our own namespace
* The default clock is `steady_clock`, not `high_resolution_clock`,
because, as HH says "high_resolution_clock is useless. If you want
measure the passing of time, use steady_clock. If you want user
friendly time, use system_clock".
* Benchmarking support is opt-in, not opt-out, to avoid the large
(~10%) compile time penalty.
* Benchmarking-related options in CLI are always present, to decrease
the amount of code that is only compiled conditionally and making
the whole shebang more maintainble.
2019-06-06 21:28:56 +02:00
Joachim Meyer
ce2560ca95 Integrate Nonius benchmark into Catch2
Changes done to Nonius:
* Moved things into "Catch::Benchmark" namespace
* Benchmarks were integrated with `TEST_CASE`/`SECTION`/`GENERATE` macros
* Removed Nonius's parameters for benchmarks, Generators should be used instead
* Added relevant methods to the reporter interface (default-implemented, to avoid
breaking existing 3rd party reporters)
* Async processing is guarded with `_REENTRANT` macro for GCC/Clang, used by default
on MSVC
* Added a macro `CATCH_CONFIG_DISABLE_BENCHMARKING` that removes all traces of
benchmarking from Catch
2019-06-06 19:33:37 +02:00
Martin Hořeňovský
00347f1e79
v2.8.0 2019-05-26 22:47:00 +02:00
Martin Hořeňovský
a5a2d08fbb
Remove commented out code 2019-05-26 21:19:55 +02:00
Jozef Grajciar
0c43f98fa2 Nttp support
Closes #1531
2019-05-23 21:03:47 +02:00
Martin Hořeňovský
99602787cd
Fix error message when unmatched quotes are encountered by CAPTURE
Thanks to @ledvinap for noticing
2019-05-23 13:54:51 +02:00
Phil Nash
96355da34e StringRef no longer repoints m_start to m_data after c_str() on a substring.
This fixes an issue where a self-assignment of a StringRef copy would point into internally (and now dangling) data.
(now self-assignment check is no longer needed)
2019-05-21 00:04:44 +01:00
Jozef Grajciar
d13e094598 Remove unique type check
Closes #1628
2019-05-20 21:13:05 +02:00
Phil Nash
3bce8ba14b Fix StringRef self-assignment after substring
Thanks to Alex Tkachenko for spotting it.
2019-05-18 17:54:39 +01:00
Jozef Grajciar
e680c4b9fb fix SEGFAULT during construction of Session
coloured output tried to write startup exceptions
to stream which was not initialized
2019-05-15 20:14:25 +02:00
Martin Hořeňovský
1161011dd0
Refactor custom precision in floating point stringification
Also fixup tests.
2019-05-03 15:38:06 +02:00
mlimber
53a83e855e Add support for custom precision in floating point stringification
Closes #1612
2019-05-02 21:34:47 +02:00
Petr Ledvina
9c741fe960 Allow quotes in CAPTURE arguments (#1608)
* Allow quotes in CAPTURE arguments

Fix CAPTURE to handle string and character literals properly
2019-05-01 19:12:44 +02:00
Phil nash
00cb0035c9 Enclosed generated StringMaker for enums in Catch namespace, rather than qualified 2019-04-26 18:24:52 +01:00
Phil nash
6267b06089 Added #include for <memory> (for unique_ptr) 2019-04-26 17:06:44 +01:00
Phil nash
46066ede17 Merge branch enum stringification work 2019-04-26 11:26:45 +01:00
Phil nash
6981783178 Added some missing #includes 2019-04-25 14:19:00 +01:00
Phil nash
08c8df1e3b include StringRef, rather than fwd decl, for splitString 2019-04-25 10:32:55 +01:00
Phil nash
daeb5a87e6 Removed global qualification of specialisation 2019-04-25 10:23:58 +01:00
Phil nash
f2ee4f17ad Moved enum tests that depend on internals to IntrospectiveTests.
- also factored out makeEnumInfo, so tests don't need to touch registry
- and added usage test that involves namespace
2019-04-25 10:13:11 +01:00
Martin Hořeňovský
7c37501b07
v2.7.2 2019-04-22 23:15:59 +02:00
Martin Hostettler
4a1ca1ab55 TrackerContext: Remove misleading instance static method.
TrackerContext is not used as singleton, so just remove this misleading
method
2019-04-22 16:37:22 +02:00
Phil Nash
541f1ed1b3 Only provide CATCH_REGISTER_ENUM
No longer have version without the CATCH_ prefix
2019-04-21 20:26:46 +03:00
Phil Nash
346723c9b6 Renamed STRINGIFY_ENUM to REGISTER_ENUM 2019-04-21 20:15:26 +03:00
Phil Nash
5a74fcc9c9 Removed IEnumInfo (just use EnumInfo directly) 2019-04-21 20:09:58 +03:00
Phil Nash
9d5d719868 Changed splitString to splitStringRef
Now takes and returns StringRefs
2019-04-21 20:03:44 +03:00
Will Handley
91b617c462 Added a vector approximate matcher 2019-04-20 10:02:17 +02:00
Martin Hořeňovský
45e552528d
Remove home-rolled algorithm replacements
Previously we had them to avoid including <algorithm> in the vector
matchers, but
* we included it anyway, even though we did not use it
* we use <algorithm> anyways in the generators
2019-04-19 17:54:21 +02:00
Stephen Newell
d6fce7bf34 Fix warnings generated with -Wshadow 2019-04-18 15:30:38 +02:00
Martin Hořeňovský
c3c82f539c
Merge pull request #1336 from ax3l/topic-overrideVirtualRedundant
Refactor: override implies virtual
2019-04-18 14:10:24 +02:00
JoeyGrajciar
79417b9afc Revert "draft of nttp support"
This reverts commit 0c39409da7.
2019-04-18 11:35:33 +02:00
Jozef Grajciar
0c39409da7 draft of nttp support
added _SIG macros
2019-04-17 21:41:19 +02:00
Torfinn Berset
5ce355a38c For macOS builds, disable isDebuggerActive() for non-AppleClang targets. Fixes #1588 2019-04-10 10:19:54 +02:00
Ryan Pavlik
edde6f4736 Fix typos identified by codespell.
Self test baselines also modified accordingly, due to
one typo found in a string in test code.
2019-04-10 09:42:11 +02:00
Martin Hořeňovský
e99f1efd28
Avoid adding a default test spec when none was provided 2019-04-09 11:50:59 +02:00
Martin Hořeňovský
b9dd1936e5
v2.7.1 2019-04-08 13:38:00 +02:00
Phil nash
02f13cf95a Made onto dev build and regenerated single header 2019-04-04 16:02:58 +01:00
Phil nash
43428c6093 First commit of STRINGIFY_ENUM 2019-04-04 15:55:46 +01:00
Martin Hořeňovský
08147a23f9
Fix ObjC matchers
Closes #1571
2019-04-03 20:32:11 +02:00
Ziv Shahaf
8af8704089 support for printing test filters (PR #1585) 2019-04-03 20:24:52 +02:00
Martin Hořeňovský
3816e99d0c
Add GENERATE_COPY and GENERATE_VAR capturing generator macros 2019-03-31 14:11:10 +02:00
Martin Hořeňovský
b77cec05c0
Fix test tag parsing to split [.foo] into [.][foo] 2019-03-29 10:48:56 +01:00
Omer Ozarslan
54089c4c8c Deducing return type of map generator helper (#1576)
* Deduce map return type implicitly

Giving the first template argument to map generator function to deduce
return type is now optional even if the return type is different from
the type generated by mapped generator.
2019-03-24 15:44:22 +01:00
Alex Alabuzhev
0531965349
Suppress warning caused by ntstatus.h inclusion 2019-03-19 23:57:56 +00:00
Martin Hořeňovský
d633072794
v2.7.0 2019-03-07 21:44:57 +01:00
Omer Ozarslan
99575b45db Add unscoped info functionality
This adds UNSCOPED_INFO macro, creating a log message that is stored
until the end of next assertion or the end of test case, whichever comes
first. These messages are not scoped locally, unlike messages created by
INFO macro.
2019-03-06 22:04:35 +01:00
SimonChh
7d2451f119 Fix output redirection in failing tests (#1525)
Fixes #1514
2019-03-02 21:18:48 +01:00
Martin Hořeňovský
29b3b7ae6b
Namespace our type traits in catch_meta
Previously they could conflict with user-defined type traits that
were in the global namespace.

Fixes #1548
2019-02-23 21:06:20 +01:00
Martin Hořeňovský
693647c43f
Add ChunkGenerator
This generator collects values from the underlying generator until it
has a specified amount of them, and then returns them in one "chunk".
In case the underlying generator does not have enough elements for
a specific chunk, the left-over elements are discarded.

Closes #1538
2019-02-23 20:28:58 +01:00
Martin Hořeňovský
288387fa10
Cleanup: move things around 2019-02-23 17:16:28 +01:00
Rick de Water
165de9b072 Add RangeGenerator 2019-02-23 16:58:34 +01:00
Martin Hořeňovský
269303d9d9
Introduce random number (Integral and Float) generators 2019-02-20 00:09:15 +01:00
Khem Raj
e8bfd882e8 Fix -Wdefaulted-function-deleted warning
Clang8 warns

catch_interfaces_reporter.h:84:25: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
|         AssertionStats& operator = ( AssertionStats && )     = default;
|                         ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-02-18 20:42:42 +01:00
Paul Lesur
2bd0722470 fix "code will never be executed" under clang 2019-02-18 19:01:43 +01:00
Igor Akhmetov
45ebf17ec7 Do not open the output file twice
7f229b4f caused the output file to get opened twice, while
some types of files (e.g. named pipes) can be only opened once.

After this change Session::applyCommandLine opens the output file
only when there is an error to print.
2019-02-18 18:59:54 +01:00
Martin Hořeňovský
093b72416d
Remove non-ASCII characters from the distributable parts
Closes #1542
2019-02-18 10:33:41 +01:00
Tobias Ribizel
c99a346490 Use correct type name instead of index for TEMPLATE_PRODUCT_TEST_CASE (#1544)
Previously, for a TEMPLATE_PRODUCT_TEST_CASE("Test" ..., T, (P1, P2)),
the generated test case names were

  Test - 0
  Test - 1

With this commit, the correct typename is used:

  Test - T<P1>
  Test - T<P2>

-----------

MSVC needs another indirection to evaluate INTERNAL_CATCH_STRINGIZE
and also inserts a space before theINTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS
parameter, which we can get rid of by pointer arithmetic.
2019-02-17 21:52:22 +01:00
Martin Hořeňovský
dbbab8727c
v2.6.1 2019-02-12 19:58:12 +01:00
Jozef Grajciar
7f229b4ff1 fix SEGFAULTs
issue was that mutable context had no config thus trying to get stream
caused SEGFAULT

Closes #1533, #1534
2019-02-08 10:41:23 +01:00
Martin Hořeňovský
d75e9b3c0f
v2.6.0 2019-01-31 22:32:55 +01:00
Robin Moussu
16dc219704 Add to string for std::optional 2019-01-31 15:35:13 +01:00
Martin Hořeňovský
5929d9530c
Add generic generator modifiers
This means mutiple generic generators and some inference helper
* take(n, generator)
* filter(predicate, generator)
* map(func, generator)
* repeat(generator, repeats)
2019-01-31 10:43:15 +01:00
Martin Hořeňovský
e46a70f829
Redo generator interface 2019-01-31 10:43:06 +01:00
Martin Hořeňovský
64a9c02315
Remove obsolete IndexTracker 2019-01-29 14:45:52 +01:00
Robin Moussu
50fefd059a fix variant detection with non-clang compiler 2019-01-26 18:35:14 +01:00
Martin Hořeňovský
d9e99dc2ca
Improve explanation of why -Wparentheses suppression leaks
Related to #1508
2019-01-25 21:29:12 +01:00
Jozef Grajciar
899c5ed3df Console Colour: fix compilation 2019-01-19 23:12:54 +01:00
Martin Hořeňovský
084b1d5fe6
Fix colourized output to file
This change should be backwards compatible, but it would be better
to make the console colour API take an argument in the long term.

Fixes #1502
2019-01-19 13:32:39 +01:00
Martin Hořeňovský
61e1ea9185
Merge pull request #1492 from Lotterleben/fix_1394
fix #1394: avoid superfluous re-run when specific section is selected
2019-01-18 16:46:40 +01:00
Lotte Steenbrink
d084162b2f Avoid superfluous re-run when specific section is selected
Fixes #1394
2019-01-18 15:13:40 +01:00
Martin Hořeňovský
75200b462c
Change CATCH_BREAK_INTO_DEBUGGER to always expand into a function call
This avoids -Wextra-semi-stmt warning inside our code
2019-01-13 23:22:36 +01:00
Martin Hořeňovský
17e09be3b9
Fix stupid (C4800) warning 2019-01-13 19:01:12 +01:00
Martin Hořeňovský
1c99b0ff81
Minor cleanup in decomposer 2019-01-13 16:23:20 +01:00
Martin Hořeňovský
64a0f466ec
Add missing noexcept in move constructors
Because both copy and move operations are trivial, this doesn't
actually change anything, but it silences a static analysis warning.
2019-01-13 16:17:42 +01:00
Axel Huebl
47602ac556 RunContext: Uninit Member
Fix an uninitialized member in `RunContext`.

Found with coverity in a downstream project.
2019-01-13 10:26:47 +01:00
Axel Huebl
d1e7344f16 ClockEstimate: DivByZero
The clock estimator has a potential division by zero.
Using `iteration + 1` seems also more logical to me for
an average.

Found with coverity in a downstream project.
2019-01-11 11:55:51 +01:00
Jozef Grajciar
bdee512057 small cleanup of code 2019-01-10 13:07:54 +01:00
Axel Huebl
188b3e6511 hexEscapeChar: restore stream
The ostream passed as reference to `hexEscapeChar` is manipulated
and its original state not restored. This fixes it.

Seen via coverity in a downstream project.
2019-01-10 13:05:36 +01:00
Antonio Mallia
bbf70ca74b Missing <type_traits> include 2019-01-10 12:52:15 +01:00
Martin Hořeňovský
c1720d0c42
Fix assert message
I messed up copy-paste when modifying the assert messages in last
commit.
2019-01-03 10:14:15 +01:00
hbina4326
d54c2258e0 Add additional static_assert for the REQUIRE(a == b && c == d) case 2019-01-02 22:44:54 +01:00