Commit Graph

3253 Commits

Author SHA1 Message Date
John Bytheway
f696ab836b Change random test shuffling technique
Previously a random test ordering was obtained by applying std::shuffle
to the tests in declaration order.  This has two problems:

- It depends on the declaration order, so the order in which the tests
  will be run will be platform-specific.
- When trying to debug accidental inter-test dependencies, it is helpful
  to be able to find a minimal subset of tests which exhibits the issue.
  However, any change to the set of tests being run will completely
  change the test ordering, making it difficult or impossible to reduce
  the set of tests being run in any reasonably efficient manner.

Therefore, change the randomization approach to resolve both these
issues.

Generate a random value based on the user-provided RNG seed.  Convert
every test case to an integer by hashing a combination of that value
with the test name.  Sort the test cases by this integer.

The test names and RNG are platform-independent, so this should be
consistent across platforms.  Also, removing one test does not change
the integer value associated with the remaining tests, so they remain in
the same order.

To hash, use the FNV-1a hash, except with the basis being our randomly
selected value rather than the fixed basis set in the algorithm.  Cannot
use std::hash, because it is important that the result be
platform-independent.
2020-04-14 12:47:36 +02:00
Martin Hořeňovský
5d32ce26f4
Fix bug in test spec parser handling of escaping in ORed patterns
It did not clear out all of its internal state when switching from
one pattern to another, so when it should've escaped `,`, it took
its position from its position in the original user-provided string,
rather than its position in the current pattern.

Fixes #1905
2020-04-12 18:48:52 +02:00
Andrew Gaspar
035a062596 Remove usage of __builtin_constant_p under IBM XL 2020-04-10 20:55:23 +02:00
Moritz Haase
d399a308d0 Suppress clang-tidy warning about vararg usage in assertion macros
CATCH_INTERNAL_IGNORE_BUT_WARN() introduced with b7b346c triggers
clang-tidy warning 'cppcoreguidelines-pro-type-vararg' for every usage
of assertion macros like CHECK() and REQUIRE(). Silence it via NOLINT
in the '#if defined(__clang__)' block only, as clang-tidy honors those.
2020-04-02 20:45:57 +02:00
Phoebe
b8ce814ee6
Add vcpkg installation instructions (#1898)
* Add vcpkg installation instructions

* Add index
2020-03-31 19:12:10 +02:00
Mark Gillard
6260962108 Added toml++ to opensource-users.md 2020-03-29 14:21:57 +02:00
Mark Gillard
b4c8967ac5 Fix alphabetical ordering of opensource-users.md 2020-03-29 14:21:57 +02:00
pi1024e
7900fb3abb C-header updates 2020-03-28 18:00:42 +01:00
Invincible
01bdfe3312 Change PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME conditional.
When no TEST_CASE_METHOD function, there is no fixture to get.
2020-03-27 09:55:06 +01:00
Joel Uckelman
e5c9a58d66 Fixed typo in "benchmark name" column width calculation. Closes #1885. 2020-03-26 10:31:35 +01:00
Martin Hořeňovský
255aa5f2af
v2.11.3 2020-03-19 13:50:19 +01:00
Martin Hořeňovský
3a33315ff8
Fix compilation error when lambdas are used in assertions
This is a partial revert of b7b346c3e5.
2020-03-19 13:32:45 +01:00
Martin Hořeňovský
5f94c8dafb
v2.11.2 2020-03-19 12:37:51 +01:00
Martin Hořeňovský
695a356f93
Move all scripts to Python3 2020-03-19 12:36:30 +01:00
Martin Hořeňovský
020b655635
Update wandbox script to use https endpoint and Python3 2020-03-19 12:32:34 +01:00
Martin Hořeňovský
5561d0342d Different approach to proper colouring of filters 2020-03-19 11:08:01 +01:00
Till Hofmann
3a15315a37 Switch back to uncolored output after printing filters
After printing the list of filters, switch back from yellow to black
before printing a newline to avoid the remaining output to be colored in
yellow.
2020-03-19 11:08:01 +01:00
Martin Hořeňovský
b7b346c3e5
Make warnings in assertions fire for GCC/Clang again
The old code caused warnings to fire under MSVC, and Clang <3.8.
I could not find a GCC version where it worked, but I assume that it
did at some point.

This new code causes all of MSVC, GCC, Clang, in current versions,
to emit signed/unsigned comparison warning in test like this:

```cpp
TEST_CASE() {
    int32_t i = -1;
    uint32_t j = 1;
    REQUIRE(i != j);
}
```

Where previously only MSVC would emit the warning.

Fixes #1880
2020-03-19 09:45:41 +01:00
Julius Hülsmann
9e09d79946 Update tutorial.md
Fix: typo; remove trailing ","
2020-03-18 15:36:19 +01:00
Julius Hülsmann
7048c2c269 Update slow-compiles.md
Add missing "."
2020-03-18 15:35:56 +01:00
magnus.ornebring
6f77d59b16 Add king as user 2020-03-11 09:32:16 +01:00
khyperia
022b61ff92 Don't cast nanoseconds to integers when writing output 2020-03-08 12:10:44 +01:00
khyperia
87b5bf77bc include <iterator> in catch_stats.hpp
needed for std::back_inserter on some platforms
2020-02-24 19:36:34 +01:00
Martin Hořeňovský
81d52c4a5f
Specialize CATCH_TRAP() for iOS + thumb instruction set combo
Fixes #1862
2020-02-15 21:45:09 +01:00
Tristan Stenner
200b8b6fc0
Add command line option 'never' to --wait-for-keypress (#1866)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-15 20:42:57 +01:00
offa
e70fd2a4b9 Variables made const-ref. 2020-02-08 14:27:40 +01:00
offa
36170d60ca stdio.h replaced with cstdio. 2020-02-08 14:27:40 +01:00
Clare Macrae
917e92c162 Add link to list of commercial user projects 2020-02-07 15:33:55 +01:00
Clare Macrae
f54950744f Fix typo in link in docs 2020-02-07 15:33:35 +01:00
Martin Hořeňovský
b3b07215d1
Merge pull request #1854 from neheb/patch-1
catch_compiler_capabilities.h: use proper math define
2020-02-03 11:26:31 +01:00
Martin Hořeňovský
2652bb86e3
Cleanup nextafter workaround 2020-02-03 10:05:23 +01:00
Martin Hořeňovský
1715b6b923
Check for Windows instead of WIN32 for wmain entry point
Closes #1849
2020-02-03 09:33:42 +01:00
Martin Hořeňovský
f20a9dbc6e
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-01 21:06:07 +01:00
Martin Hořeňovský
273c3f85eb
Add missing ToC entry in release notes 2020-02-01 20:24:53 +01:00
Martin Hořeňovský
6a3d0dc176
Add a test for custom debug break macros
See #1846
2020-02-01 20:18:05 +01:00
khyperia
ccb1f70629 Make CATCH_BREAK_INTO_DEBUGGER be user-configurable 2020-02-01 17:01:50 +01:00
khyperia
4a5bc0f39a Make CATCH_BREAK_INTO_DEBUGGER be user-configurable 2020-02-01 12:20:40 +01:00
Rosen Penev
f96e89e016
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-01-31 22:20:59 -08:00
dmsteck
481f54b357
Make hidden tags behave identically (#1847)
Add both `[.]` and `[!hide]` tags when registering a hidden test case, as per documentation.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-01-31 21:44:06 +01:00
offa
2d172dc688 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-01-25 09:01:04 +01:00
Daniel Griscom
587a20b312 Removed unneeded 'using uchar = unsigned char' 2020-01-24 14:26:22 +01:00
Martin Hořeňovský
bff44f8b01
Merge pull request #1831 from matt77hias/master
Added <random> include for std::uniform_int_distribution
2020-01-14 14:05:50 +01:00
Matthias Moulin
4ea74ff966
Added <random> include for std::uniform_int_distribution 2020-01-14 12:48:09 +01:00
Martin Hořeňovský
d10b9bd02e
v2.11.1 2019-12-28 21:24:04 +01:00
Martin Hořeňovský
55794e9b27
Avoid detecting Clang as having MSVC's traditional preprocessor
Fixes #1806
2019-12-28 18:57:24 +01:00
ptc-tgamper
fa6211bfc2 catch_debugger.h - implement break into debugger assembler instructions for iOS 2019-12-23 21:26:13 +01:00
ptc-tgamper
4e90f910dc catch_console_colour.cpp - adjust useColourOnPlatform for iOS 2019-12-23 21:26:13 +01:00
ptc-tgamper
0c59cc83cf catch_debugger.cpp - debugger detection is identical on Mac OS X and iOS 2019-12-23 21:26:13 +01:00
Martin Hořeňovský
e4004e0adb
Provide const overload of ObjectStorage::stored_object()
Fixes #1820
2019-12-23 21:22:32 +01:00
Joe Burzinski
6c9a255dc2 Fix forwarding in SingleValueGenerator and generator creation
Fixes #1809
2019-12-15 20:50:43 +01:00