Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests
diff options
context:
space:
mode:
authorqerased2026-01-03 01:15:13 +0300
committerGitHub2026-01-02 23:15:13 +0100
commitb66b89374e60fa2fb725814acefbfc987ee5ff5e (patch)
tree3f01c6cd3b3710cdb2a56d518f4eac152a24f386 /tests/SelfTest/IntrospectiveTests
parentb7e31c9ab3a4b6f7ef5f11d01aa3453c03e695b6 (diff)
downloadcatch3-b66b89374e60fa2fb725814acefbfc987ee5ff5e.tar.gz
Add validation for --benchmark-samples to prevent crash with zero value (#3056)
* Add validation for --benchmark-samples to prevent crash with zero samples * Add automated test for benchmark samples validation * Update baselines for benchmark-samples validation * Add missing test for benchmark samples validation --------- Co-authored-by: Chan Aung <chan@Thinkpad.localdomain>
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index 404bad27..2cb7cae2 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -301,6 +301,23 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
REQUIRE(config.benchmarkSamples == 200);
}
+ SECTION("samples must be greater than zero"){
+ auto result = cli.parse({"test", "--benchmark-samples=0"});
+
+ CHECK_FALSE(result);
+ REQUIRE_THAT(
+ result.errorMessage(),
+ ContainsSubstring("Benchmark samples must be greater than 0"));
+ }
+
+ SECTION("samples must be parseable") {
+ auto result = cli.parse({"test", "--benchmark-samples=abc"});
+
+ CHECK_FALSE(result);
+ REQUIRE_THAT(
+ result.errorMessage(),
+ ContainsSubstring("Could not parse 'abc' as benchmark samples"));
+ }
SECTION("resamples") {
CHECK(cli.parse({ "test", "--benchmark-resamples=20000" }));