Commit Graph

4246 Commits

Author SHA1 Message Date
autoantwort
8ce92d2c72
CatchMiscFunctions.cmake: Use PRIVATE for target_compile_options (#2553)
With the changes to how `-ffile-prefix-map` is detected, Catch2 started propagating the flag to its dependents, which isn't the desired behaviour, the normalization should only apply to Catch2's impl.
2022-10-24 18:26:40 +02:00
Martin Hořeňovský
a43f67962e
Refactor parsing of shard index/count in cmdline handling
This worsens the message for negative numbers a bit, but
simplifies the code enough that this is still a win.
2022-10-23 00:10:05 +02:00
Martin Hořeňovský
f1361ef624
Refactor how the RNG seed is parsed when handling cmdline 2022-10-22 22:18:30 +02:00
Martin Hořeňovský
d1e7544e9f
Simplify handling of environment in Bazel's support 2022-10-22 22:18:27 +02:00
Martin Hořeňovský
3fed2307e7
Add Detail::getEnv wrapper that compiles under UWP
Under UWP it will always return nullptr, so UWP will essentially
behave as if the environment was just empty.
2022-10-22 22:18:24 +02:00
Martin Hořeňovský
2d0dcc36e8
Add Bazel support to the documentation 2022-10-21 10:53:55 +02:00
Martin Hořeňovský
80d58a791d
Add support for Bazel's sharding env variables
Closes #2491
2022-10-21 10:53:53 +02:00
Martin Hořeňovský
d7341b5dc1
Add parseUInt utility function
There is an increasing number of places where Catch2 wants to parse
strings into numbers, but being stuck in C++14 world, we do not
have good stdlib facilities to do this (`strtoul` and `stoul`
are both bad).
2022-10-21 10:53:50 +02:00
Martin Hořeňovský
38d926090a
Tiny fix for testBazelReporter.py 2022-10-20 21:34:35 +02:00
Martin Hořeňovský
9d08689845
Add support for Bazel's TESTBRIDGE_TEST_ONLY env var
Closes #2490
2022-10-20 21:34:32 +02:00
Martin Hořeňovský
afc017ef52
Rename provideBazelReporterOutput -> enableBazelEnvSupport
The new name better reflects that we are adding support for more
Bazel environment variables.
2022-10-20 21:34:27 +02:00
Martin Hořeňovský
fb68bb0bd5
Fix microbenchmark example in the main readme.md 2022-10-20 21:34:25 +02:00
Martin Hořeňovský
77f7c0104d
Fix fibonacci impl in benchmark tests
The previous implementation was always 1 number ahead. Fixing this
is not important at all, but it was bugging me.
2022-10-18 10:44:18 +02:00
Martin Hořeňovský
be060cde44
Update README.md
* Add usage examples to the introduction
* Mention that v3 has been released
2022-10-17 21:47:22 +02:00
Martin Hořeňovský
5df88da16e
3.1.1 2022-10-17 19:57:58 +02:00
Martin Hořeňovský
5cd8938905
Update explanation of REQUIRE_FALSE in docs/assertions.md 2022-10-17 15:13:00 +02:00
Martin Hořeňovský
6a422bae0b
Trim superfluous whitespace in docs 2022-10-17 15:02:45 +02:00
Martin Hořeňovský
a07ac3f935
Rewrite explanation of problems with && and || in assertions 2022-10-17 12:36:02 +02:00
Martin Hořeňovský
d8619f076b
Fixup shard index docs
Closes #2547
2022-10-16 17:00:29 +02:00
Martin Hořeňovský
95cd95e591
Add extra explanations to some items in docs/readme.md
This should make it easier for people to find what they need, e.g.
finding generators by looking for "value parameterized tests".
2022-10-15 23:50:20 +02:00
Martin Hořeňovský
eb7397544c
Bold section 'headings' in docs/readme.md 2022-10-15 23:50:18 +02:00
Sam Cunliffe
d1394a7064 Link to SECTIONS doc at top of test fixtures page.
I came here looking for a way to use a fixture. But what I really wanted was better done in the SECTION macro. Feels like a link right at the top would've made it clearer faster.
2022-10-15 16:59:52 +02:00
Martin Hořeňovský
e94976ec9c
Downgrade MacOS version in GHA 2022-10-15 13:06:50 +02:00
Martin Hořeňovský
0c962d11b3
Centralize and update docs for floating point comparisons
The new docs mention that Approx is deprecated and should not be
used, and explain the reasons behind it.

Closes #1444
2022-10-15 11:02:58 +02:00
Teskann
bdf30834eb Mute the sign conversion warning with explicit cast 2022-10-09 19:02:32 +02:00
Tim Blechmann
728de353be
improve -ffile-prefix-map detection (#2517)
the current implementation has two problems:
  * `clang-cl` does not know `-ffile-prefix-map`, but in CMake it is
    reported as "Clang", so the compiler will warn about an unknown
    compiler option.
  * XCode's clang in CMake is reported as "AppleClang", so it is not picked
    up as "Clang", so it is not passed `-ffile-prefix-map`, even though
    it supports it.

Also changed the map so that the normalized `__FILE__` paths are the same
as what the approval tests normalize paths into.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2022-10-04 15:55:50 +02:00
Jonathan Wright
0e139b73e4
add versioning to shared libs (#2516)
* add versioning to shared libs

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2022-10-04 15:49:09 +02:00
Roland Kaminski
97313f9033 fix compilation on cygwin
Use std::char_traits<char>::find instead of strnlen for better
portability.
2022-10-04 10:50:18 +02:00
Rosen Penev
6a9bf2e0af
meson cleanups with muon (#2539)
* meson: run through muon's fmt to fix formatting

* meson: switch arrays to files

Allows muon to alphabetically sort files. switch headers back to arrays
as split() can only be used on strings.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-10-03 17:23:38 +02:00
Dimitrij Mijoski
980c20694e
Don't expose header windows.h in catch_all.hpp (#2526)
* Don't expose header windows.h in catch_all.hpp
* Fix generateAmalgamatedFiles.py
2022-10-03 15:36:37 +02:00
Mike Crowe
4db8b50aab
Add support for building with Meson (#2530)
The Meson[1] build system makes it easier incorporate third-party
libaries into a project if they also build using Meson.

Let's add a minimal Meson build that's compatible with the CMake build,
along with a GitHub workflow to check that it builds and that at least
the simplest SelfTest runs.

The handling of catch_user_config.hpp is inspired by BUILD.bazel and
doesn't attempt to support any configuratons options. Such features
could be added later.

Meson strongly discourages using wildcards to specify sources, so the
source and header lists are copied from CMakeLists.txt.

Add a new test workflow to test the Meson builds. I was unable to get
these tests to pass with Ubuntu 20.04, so they use Ubuntu 22.04.

I'm neither a CMake nor a Meson expert, but the results seem to work for
me.

[1] https://mesonbuild.com/

Co-authored-by: Mike Crowe <mcrowe@brightsign.biz>
2022-10-01 23:28:30 +02:00
Sergey Evsegneev
4a7cefe601 Unused variable removed 2022-09-28 16:02:10 +02:00
Vertexwahn
243cf71608 Make Bazel work with CATCH_CONFIG_SHARED_LIBRARY 2022-09-27 22:06:12 +02:00
Vertexwahn
4bb7e02a9c Bazel build: Update of skylib 2022-09-27 22:06:12 +02:00
Rutayan Patro
97d0b1e00e
Suppress clang-tidy warnings for TEMPLATE_TEST_CASE (#2536)
* Suppress clang-tidy *-avoid-c-arrays for TEMPLATE_TEST_CASE
* Made globalRegistrar `const` to avoid `cppcoreguidelines-avoid-non-const-global-variables`

Fixes #2095
2022-09-26 18:07:50 +02:00
Dimitrij Mijoski
c0e582e659 Fix building as shared library with MSVC. 2022-09-24 15:15:50 +02:00
Björn Schäpers
0de60d8e7e Suppress -Wuseless-cast Warning
Fixes #2520.
2022-09-22 21:00:05 +02:00
Zhi Wang
d6bbd3fdef warning: storage class is not first
This pull request fixes the warning issued by `nvc++`
(the C++ compiler in Nvidia HPC SDK/PGI),
and is similar to pull request #1717.
2022-09-21 20:14:12 +02:00
Dimitrij Mijoski
98d37da03e
Raise the minimum CMake version to 3.10 (#2523) 2022-09-16 17:56:00 +02:00
Dimitrij Mijoski
4b3defe4af Suppress warning "-Wstrict-aliasing" for GCC 5 and 6 2022-09-15 13:40:16 +02:00
Dimitrij Mijoski
c75430834d Add GCC 5 and GCC 6 to CI 2022-09-15 13:40:16 +02:00
Tim Blechmann
359542d53e FileStream: enable automatic flushing
when a test executable is killed by a signal (e.g. when executed by
ctest with timeout), the reporter files are not flushed. this can lead
to incomplete (or empty) report files.
to avoid this we enable automatic flushing via `std::unitbuf`

compare #663
2022-09-11 23:49:15 +02:00
tocic
dea1a6abd9
Fix typos in docs (#2514) 2022-09-09 16:00:39 +02:00
Riom
32eae0ecce
Add missing include for VxWorks build. (#2515)
`catch_sharding.hpp` was using `std::min` without including `<algorithm>`.
This worked on most platforms, but it wasn't transitively included in
the VxWorks toolchain.
2022-09-08 10:21:36 +02:00
Martin Hořeňovský
4adf010549
Mention dynamic library stuff in the FAQ
Closes #2497
2022-09-03 22:31:29 +02:00
Martin Hořeňovský
686468d185
Explain TU as translation unit where appropriate 2022-09-03 22:22:10 +02:00
Martin Hořeňovský
7b2e7d623b
Disable Bazel's env checking on UWP
UWP does not support environment variables and so it cannot
compile code using getenv.
2022-09-02 07:11:28 +02:00
Martin Hořeňovský
3ca5cf32e5
Add CATCH_PLATFORM_WINDOWS_UWP detection macro 2022-09-02 07:10:38 +02:00
Martin Hořeňovský
dc001fa935
Allow easy retrieval of RNG seed by the users
This makes it so that they don't need parallel RNG seed passing
infrastructure for randomized data generation (e.g. inputs for
benchmarks).
2022-08-18 23:23:18 +02:00
Martin Hořeňovský
33e70194d3
Link to the randomized-shard-registration script from usage tips 2022-08-18 00:14:07 +02:00