Commit Graph

4510 Commits

Author SHA1 Message Date
Martin Hořeňovský
822c44a203
Cleanup help string construction in Clara
* Clara::Opt::getHelpColumns returns single item

  It could never return multiple items, but for some reason it
  was wrapping that single item in a vector.

* Use ReusableStringStream in Clara
* Reserve HelpColumns ahead of time
* Use StringRef for descriptions in HelpColumn type

The combination of these changes ends up removing about 7% (~200)
of allocations when Catch2 has to prepare output for `-h`.
2023-12-26 14:57:29 +01:00
Martin Hořeňovský
2295d2c8cc
Store Opt/Arg hint and description as StringRef
There is no good reason for these to be std::strings, as these
are just (optional) constants for nice user output. This ends up
reducing the allocations significantly.

When measuring allocations when running no tests, the changes are
`tests/SelfTest` 9213 -> 7705
`tests/ExtraTests/NoTests` 3723 -> 2215
2023-12-26 14:40:45 +01:00
Martin Hořeňovský
2b69a3e216
Remove superfluous catch_session.hpp include in catch_sharding.hpp 2023-12-26 14:02:19 +01:00
Martin Hořeňovský
c809cb4d1c
Update Doxyfile for newer doxygen 2023-12-23 11:27:46 +01:00
Martin Hořeňovský
9aadc3a53d
Cleanup includes in sources
Mainly just removes some unused includes, but sometimes the include
is replaced by a smaller header instead.
2023-12-23 11:23:32 +01:00
Martin Hořeňovský
64ade68ca2
Remove superfluous duration_casts from benchmarking 2023-12-21 18:40:00 +01:00
Martin Hořeňovský
680064d391
Don't store right end of the interval in uniform_integer_distribution 2023-12-21 18:39:18 +01:00
Martin Hořeňovský
3acb8b30f1
More detailed examples for lifetimes in combined matcher exprs
Example taken from #2777
2023-12-13 17:24:23 +01:00
Martin Hořeňovský
3f23192e55
Fix typo in release notes 2023-12-13 17:24:18 +01:00
Igor Machado Coelho
d40a3289e5
Support MODULE.bazel (#2781) 2023-12-13 17:22:56 +01:00
Martin Hořeňovský
53d0d913a4
v3.5.0 2023-12-11 00:55:40 +01:00
Martin Hořeňovský
1648c30ec3
Look just for 'Catch2 X.Y.Z' in doc placeholder update 2023-12-11 00:52:22 +01:00
Simhon Chourasia
d4e9fb8aa5
Highlight that SECTIONs rerun the entire test case from beginning (#2749) 2023-12-10 22:35:54 +01:00
Martin Hořeňovský
b606bc2802
Remove obsolete section in limitations.md
We no longer use `std::shuffle` to implement random test order, so
a debug mode bug in old versions of libstdc++ cannot apply to us.
2023-12-10 22:09:48 +01:00
Blake-Madden
4ab0af8baf
Fix minor typos in documentation (#2769)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-12-10 22:01:13 +01:00
Martin Hořeňovský
b7d70ddcd6
Ensure we always read 32 bit seed from std::random_device 2023-12-10 21:37:12 +01:00
Martin Hořeňovský
a6f22c5169
Remove static instance of std::random_device in Benchmark::analyse_samples 2023-12-10 21:22:43 +01:00
Martin Hořeňovský
1887d42e3d
Use our PCG32 RNG instead of mt19937 in Benchmark::analyse_samples 2023-12-10 21:18:23 +01:00
Martin Hořeňovský
1774dbfd53
Make it clearer that the JSON reporter is WIP 2023-12-10 21:04:56 +01:00
Martin Hořeňovský
cb07ff9a7e
Fix uniform_floating_point_distribution for unit ranges 2023-12-10 19:53:46 +01:00
Martin Hořeňovský
ae4fe16b81
Make the user-facing random Generators reproducible
Thanks to the new distributions, this is almost trivial change.
2023-12-10 19:53:44 +01:00
Martin Hořeňovský
28c66fdc5a
Make uniform_floating_point_distribution reproducible
By moving to use our `uniform_integer_distribution`, which is
reproducible across different platforms, instead of the stdlib
one which is not, we can provide reproducible results for `float`s
and `double`s. Still no reproducibility for `long double`s, because
those are too different across different platforms.
2023-12-10 19:53:41 +01:00
Martin Hořeňovský
ed9d672b5c
Add uniform_integer_distribution 2023-12-10 19:53:39 +01:00
Martin Hořeňovský
04a829b0e1
Add helpers for implementing uniform integer distribution
* Utility for extended mult n x n bits -> 2n bits
* Utility to adapt output from URBG to target (unsigned) integral
  type
* Utility to reorder signed values into unsigned type while keeping
  the order.
2023-12-10 19:53:36 +01:00
Martin Hořeňovský
ab1b079e4d
Add uniform_floating_point_distribution 2023-12-10 18:44:12 +01:00
Martin Hořeňovský
d139b4ff7c
Add implementation of helpers for uniform float distribution
Specifically we add
 * `gamma(a, b)`, which returns the magnitude of largest 1-ULP
   step in range [a, b].
 * `count_equidistant_float(a, b, distance)`, which returns the
   number of equi-distant floats in range [a, b].
2023-12-10 18:44:10 +01:00
Martin Hořeňovský
bfd9f0f5a6
Move nextafter polyfill to polyfills.hpp 2023-12-10 18:44:06 +01:00
Martin Hořeňovský
9a1e73568c
Add test showing literals and complex generators in one GENERATE 2023-12-10 18:32:45 +01:00
Ikko Eltociear Ashimine
21d2da23bc Fix typo in tostring.md
specialiation -> specialization
2023-12-09 21:00:24 +01:00
Martin Hořeňovský
d1d7414eb9
Always run apt-get update before apt-get install
The base images for GitHub Actions are updated weekly, but
sometimes that is not enough to be able to install the packages
we require. The recommended fix for this is to always run
`apt-get update` before `apt-get install`.
2023-12-09 12:05:45 +01:00
Martin Hořeňovský
dacbf4fd6c
Drop VS 2017 support
We do not support specific compilers, but rather compilers with
reasonable quality of their C++14 support. While developing the
new random generators, I ran into issues with VS2017 where it
rejects perfectly valid C++14 code, **and** the error does not
point me in the right direction to try and work around the issue.

It is time for VS2017 to go.
2023-12-08 23:54:00 +01:00
Pablo Duboue
0520ff4436 [DOC] Replaced broken link (fixes #2770)
The original link is no longer available but a fork is still on GitHub.
2023-12-02 22:05:48 +01:00
SupSuper
4a7be16c8c Fix compilation on Xbox platforms
Xbox does not support getenv
2023-12-02 22:03:48 +01:00
Martin Hořeňovský
32d9ae24bc
JSONWriter deals in StringRefs instead of std::strings
Together with liberal use of `_sr` UDL to compile-time convert
string literals into StringRefs, this will reduce the number of
allocation and remove most of the strcpy calls inherent in
converting string lits into `std::string`s.
2023-11-17 09:54:03 +01:00
Sergei Iskakov
de7ba4e889 fn need to be in parenthesis
Otherwise intel c++ 19.1 cause an error
"expression preceding parentheses of apparent call must have (pointer-to-) function type CATCH2"
2023-11-16 12:33:35 +01:00
Martin Hořeňovský
733b901dd2
Fix special character escaping in JsonWriter 2023-11-14 23:35:22 +01:00
Beartama
7bf136b501
Add JSON reporter (#2706)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-11-14 22:52:15 +01:00
Gerald Senarclens de Grancy
2c68a0d05f lifted suggested version
Did this, because with 3.0.1, the files
- catch_xmlwriter.cpp
- catch_string_manip.hpp
- catch_test_case_info.hpp

were missing

This led to some obvious and some obscure compile errors when compiling
with g++ 13.2.0 (std c++17 or c++20)
One of these errors being "Elaborated-type-specifier for a scoped enum
must not use the ‘class’ keyword"

Since this is a rather bad experience and debugging it is
time-consuming, I suggest to simply boost the recommended version in the
snippet which is likely copied by new Catch2 users
2023-11-14 17:10:31 +01:00
Krzysiek Karbowiak
01cac90c62
Bump up actions/checkout version to v4 (#2760) 2023-11-09 10:31:49 +01:00
Krzysiek Karbowiak
b735dfce2d
Increase build parallelism on macOS (#2759)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-11-07 22:17:47 +01:00
Martin Hořeňovský
caffe79a31
Fix missing include in catch_message.hpp
Because the issue comes from the expansions of `UNSCOPED_INFO`,
surrogate TUs could not catch this bug, and in common usage, the
include transitively comes from `catch_test_macros.hpp`.

Fixes #2758
2023-11-04 00:33:18 +01:00
Chris Thrasher
a8cf3e6710 Mark CATCH_CONFIG_ options as advanced
These options are rather low-level and don't need to be seen in the
CMake cache unless you opt into seeing all other advanced options.

This removes a lot of cache entries from the screen when using a GUI
or TUI to view the cache thus making it easier for users to focus on
the cache variables they're more likely to change on a frequent
basis.
2023-10-31 17:27:46 -06:00
Martin Hořeňovský
79d39a1954
Fix tests for C++23's multi-arg index operator
Closes #2744
2023-10-28 21:49:58 +02:00
Martin Hořeňovský
6ebc013b8c
Fix UDL definitions for C++23
Technically, the declaration should not have a space between
the quotes and the underscore, because `_foo` is a reserved
identifier, but `""_foo` is not. In general it works, but newer
Clang versions warn about this, because WG21 wants to deprecate
and later remove this form completely.
2023-10-28 21:35:03 +02:00
Alex Merry
966d361551 Improve formatting of test specification docs
The existing formatting created one-element lists separated by paragraphs, when it would make more sense to have the paragraphs that are providing more information about one of those list entries be part of the list entry itself.

I think this makes the documentation easier to read in both markdown and html form, and should also improve the structure for assistive technologies.
2023-10-24 16:01:56 +02:00
Per Lundberg
766541d12d why-catch.md: Add JetBrains survey link 2023-09-27 20:14:35 +02:00
Holger Kaelberer
7b793314e5
Catch.cmake: Support CMake multi-config with PRE_TEST discovery mode (#2739)
Closes #2746 

---------

Co-authored-by: Holger Kaelberer <Holger.Kaelberer@bmw.de>
2023-09-25 19:40:35 +02:00
Christian Tacke
0fb817e41f fix some bugprone-macro-parentheses warnings
When using the public headers of catch2 in another project
that uses clang-tidy with some checks enabled, then some
warnings in catch2's headers are also reported.

This fixes a bunch of bugprone-macro-parentheses warnings.

See: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/macro-parentheses.html
2023-09-25 10:56:45 +02:00
Martin Hořeňovský
f161110be4
Merge pull request #2747 from xandox/devel
correct argument references in CatchAddTests.cmake
2023-09-25 10:52:10 +02:00
Ilya Arzhannikov
db495acdbb
correct argument references in CatchAddTests.cmake 2023-09-20 15:47:11 +02:00