Commit Graph

3302 Commits

Author SHA1 Message Date
Martin Hořeňovský 9b5fc9eaea
Randomize test for subset invariant random ordering of tests
Also removed the iterative checking that seeds 1-100 do not create
the same output, because it used too much runtime.
2020-05-01 14:45:36 +02:00
John Bytheway 630ba26278
Add test for consistent random ordering
-- Fixed up during cherrypicking
2020-05-01 14:30:01 +02:00
John Bytheway 26b2c3e7e2
Change random test shuffling technique (refactored)
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-05-01 12:32:38 +02:00
Martin Hořeňovský 87a8b61d5a
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-05-01 09:56:34 +02:00
Andrew Gaspar ca27b0dcc5
Remove usage of __builtin_constant_p under IBM XL 2020-05-01 09:31:59 +02:00
Moritz Haase 87c8055176
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-05-01 09:31:48 +02:00
Phoebe 46cc551b7a
Add vcpkg installation instructions (#1898)
* Add vcpkg installation instructions

* Add index
2020-05-01 09:31:41 +02:00
Mark Gillard f34aacfe5f
Added toml++ to opensource-users.md 2020-05-01 09:31:12 +02:00
Mark Gillard 0d3e933d71
Fix alphabetical ordering of opensource-users.md 2020-05-01 09:31:03 +02:00
pi1024e 02a998598c
C-header updates 2020-05-01 09:30:50 +02:00
Invincible 8ea45bf50c
Change PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME conditional.
When no TEST_CASE_METHOD function, there is no fixture to get.
2020-05-01 09:30:31 +02:00
Joel Uckelman beb8c3a99d
Fixed typo in "benchmark name" column width calculation. Closes #1885. 2020-05-01 09:30:17 +02:00
Martin Hořeňovský 656b15d37b
Pick doc changes for v2.11.3 2020-05-01 09:28:17 +02:00
Martin Hořeňovský 5198fd3c9a
Fix compilation error when lambdas are used in assertions
This is a partial revert of b7b346c3e5.
2020-05-01 09:24:26 +02:00
Martin Hořeňovský 08f8a81b2c
Picking v2.11.2 docs changes 2020-04-30 21:44:16 +02:00
Martin Hořeňovský 0d8eeec557
Move all scripts to Python3 2020-04-29 21:28:52 +02:00
Martin Hořeňovský d3c0b36487
Update wandbox script to use https endpoint and Python3 2020-04-29 21:28:34 +02:00
Martin Hořeňovský 95a2e54702
Different approach to proper colouring of filters 2020-04-29 21:28:25 +02:00
Till Hofmann 6badd7d9ed
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-04-29 21:28:18 +02:00
Martin Hořeňovský 60cfaa38fb
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-04-29 21:27:57 +02:00
Julius Hülsmann 38a0dfca6d
Update tutorial.md
Fix: typo; remove trailing ","
2020-04-29 21:17:54 +02:00
Julius Hülsmann b014d988fe
Update slow-compiles.md
Add missing "."
2020-04-29 21:17:30 +02:00
magnus.ornebring 7a0f8ff4b8
Add king as user 2020-04-29 16:55:03 +02:00
khyperia efbfaa1704
Don't cast nanoseconds to integers when writing output 2020-04-29 16:54:46 +02:00
khyperia c4e5b05cfc
include <iterator> in catch_stats.hpp
needed for std::back_inserter on some platforms
2020-04-29 16:54:39 +02:00
Martin Hořeňovský 0fdeb10c65
Cleanup how configuration-dependent test macros are defined 2020-04-29 15:36:40 +02:00
Martin Hořeňovský 783ab5ef87
Move around message macros and implementation 2020-04-29 14:02:53 +02:00
Martin Hořeňovský 8d50f04419
Move around matcher macro implementation 2020-04-26 21:33:55 +02:00
Martin Hořeňovský 804e2df099
Move Benchmarking macros to catch_benchmark.hpp 2020-04-26 19:24:36 +02:00
Martin Hořeňovský 0470794a68
Split TEMPLATE_TEST* macros into their own set of files
These files are not included by the default
`#include <catch2/catch_test_macros.hpp>` path, so that users do
not have to pay for them if they do not use them. Follow up is to
split out the small part of `catch_preprocessor.hpp` used by the
default test macros (AFAIK, it is just `INTERNAL_CATCH_REMOVE_PARENS`
macro), so that it is not included by the default path either.

Also fixes #1892 by providing the missing macros.
2020-04-26 16:25:43 +02:00
Martin Hořeňovský 5150fa4476
Rename catch_capture.hpp to more descriptive catch_test_macro_impl.hpp 2020-04-26 13:32:17 +02:00
Martin Hořeňovský d776a93a39
Development build defaults to off 2020-04-25 18:18:45 +02:00
Martin Hořeňovský c078373f3f
Rename internal macro for suppression of unused variable warnings 2020-04-25 18:13:17 +02:00
Martin Hořeňovský 517839fb3f
Small cleanup of fatal condition handler 2020-04-25 14:07:50 +02:00
Martin Hořeňovský b955355ec4
Avoid recompiling main for each example
Instead, link against `Catch2Main` CMake target as intended.
2020-04-24 21:13:07 +02:00
Martin Hořeňovský c5ec936a72
Inline TagAlias constructor
It is trivial enough that the function call is not worth it, and
lets us remove one TU from compilation.
2020-04-24 21:09:10 +02:00
Martin Hořeňovský 8d44c2450c
Add some explanatory comments to ErrnoGuard 2020-04-24 21:04:54 +02:00
Martin Hořeňovský 7c97554565
Remove Obj-C(++) support 2020-04-24 20:42:52 +02:00
Martin Hořeňovský e1e6872c4c
Standardize header names and file locations
This is both a really big and a really small commit. It is small in
that it only contains renaming, moving and modification of include
directives caused by this.

It is really big in the obvious way of touching something like 200
files.

The new rules for naming files is simple: headers use the `.hpp`
extension. The rules for physical file layout is still kinda in
progress, but the basics are also simple:
 * Significant parts of functionality get their own subfolder
   * Benchmarking is in `catch2/benchmark`
   * Matchers are in `catch2/matchers`
   * Generators are in `catch2/generators`
   * Reporters are in `catch2/reporters`
   * Baseline testing facilities are in `catch2/`
 * Various top level folders also contain `internal` subfolder,
   with files that users probably do not want to include directly,
   at least not until they have to write something like their own
   reporter.
    * The exact files in these subfolders is likely to change later
      on

Note that while some includes were cleaned up in this commit, it
is only the low hanging fruit and further cleanup using automatic
tooling will happen later.

Also note that various include guards, copyright notices and file
headers will also be standardized later, rather than in this commit.
2020-04-24 18:58:44 +02:00
Martin Hořeňovský 3836aa9ceb
Remove catch_user_interfaces
It used to be a file that would collect interfaces we always wanted
to provide to users, so that the single header stitching script
would place them in the common part of the single header version.

As v3 is moving to separate headers model, the file is no longer
useful.
2020-04-24 15:34:12 +02:00
Martin Hořeňovský 3f2ada03d5
Remove unused catch_impl.hpp header
It became useless when we moved away from the single-header model,
because it was used an entry point for stitching CPP into the single
header file.
2020-04-24 14:25:33 +02:00
Martin Hořeňovský 7892954c99
Remove global warning manipulation headers
They were unused except for one test file anyway.
2020-04-05 19:14:16 +02:00
Martin Hořeňovský 54a7eb1aed
Rename reporters to use .hpp suffix
I want to standardize _all_ of Catch2 headers on the `.hpp` suffix.
2020-04-05 19:10:57 +02:00
Martin Hořeňovský 151dccbd31
Remove catch.hpp
This was an old "include all" header, that we no longer want to be
usable, to make the include differences in new versions explicit.

We will introduce new "include all" headers later, in the form of
`catch_all.hpp`, `catch_matchers_all.hpp` and so on...
2020-03-29 21:32:13 +02:00
Martin Hořeňovský 4d63c36402
Update release notes with matcher changes 2020-03-29 14:57:29 +02:00
Martin Hořeňovský a25d83d8c4
Matcher type flattening overloads of && and || are now hidden friends 2020-03-29 14:03:29 +02:00
Martin Hořeňovský f7d7aa9eb2
Fix and extend tests for composing generic matchers 2020-03-29 14:03:12 +02:00
Martin Hořeňovský ca5af2e85b
Cleanup vector matchers
Once again, added doxygen comments and removed the inner-most namespace.
2020-03-28 15:17:12 +01:00
Martin Hořeňovský 904c47a634
Cleanup string matchers
Removed nested `StdString` namespace and added Doxygen comments.
Also renamed some matchers to avoid colisions now that there are
less separate namespaces for matchers to go to. Since this is a
breaking release anyway, it shouldn't matter, and the factory
functions that the users should use remain the same anyway.
2020-03-28 15:15:31 +01:00
Martin Hořeňovský afc8b28c07
Cleanup for floating point matchers
Removed the `Floating` nested namespace and added Doxygen comments
for the factory methods.
2020-03-28 12:48:19 +01:00