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

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Catch3/Generators/Boolean.hpp
diff options
context:
space:
mode:
authorLeitwolf112026-09-24 22:07:03 +0300
committerLeitwolf112026-09-24 22:07:03 +0300
commit9ad804cedf4cc4a85ef89fe097f97a3b44654360 (patch)
treef088e919776b22d19387377bdbec727daa2429c0 /src/Progmasoft/Catch3/Generators/Boolean.hpp
parent02f8b5593a15cdec8558256e6f40a0c7fb5862d6 (diff)
downloadcatch3-0.1.0.tar.gz
Add Progmasoft Catch3 property testing and build support0.1.0
Introduce deterministic property execution, built-in generators, shrinking, replayable seeds, and a separate Progmasoft-owned header API while preserving Catch2 compatibility targets and the C++14 engine baseline. Add Bazel, Meson, Xmake, and Premake integration and tests alongside the existing CMake build. Replace Linux-only workflow coverage with Windows and macOS jobs and document the Catch2/Catch3 distinction.
Diffstat (limited to 'src/Progmasoft/Catch3/Generators/Boolean.hpp')
-rw-r--r--src/Progmasoft/Catch3/Generators/Boolean.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Progmasoft/Catch3/Generators/Boolean.hpp b/src/Progmasoft/Catch3/Generators/Boolean.hpp
new file mode 100644
index 00000000..3f881927
--- /dev/null
+++ b/src/Progmasoft/Catch3/Generators/Boolean.hpp
@@ -0,0 +1,18 @@
+// Copyright (c) 2026 Progmasoft.
+// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1
+#pragma once
+
+#include <Progmasoft/Catch3/Generator.hpp>
+
+namespace Progmasoft::Catch3 {
+
+ /// Generates booleans and shrinks true to the simplest value, false.
+ [[nodiscard]] inline Generator<bool> Boolean() {
+ return MakeGenerator<bool>(
+ []( Random& random ) { return ( random.Next() & 1U ) != 0; },
+ []( const bool& value ) {
+ return value ? std::vector<bool>{ false } : std::vector<bool>{};
+ } );
+ }
+
+} // namespace Progmasoft::Catch3