aboutsummaryrefslogtreecommitdiff
path: root/src/test/gen/crypto_gen.cpp
diff options
context:
space:
mode:
authorChris Stewart <stewart.chris1234@gmail.com>2018-03-24 18:37:10 -0500
committerChris Stewart <stewart.chris1234@gmail.com>2018-08-27 08:51:51 -0500
commitb2f49bd7325989267017260a9e7c843588a8c237 (patch)
treef1ffe8bfbb8f3ff6cf210e24b3e9250097892f15 /src/test/gen/crypto_gen.cpp
parentca4510c15da2f42a1769b9cab0e26d3f855a93b3 (diff)
Integration of property based testing into Bitcoin Core
update copyright headers attempt to fix linting errors Fixing issue with make check classifying generator files as actual unit tests Wrapping gen files in ENABLE_PROPERTY_TESTS macro Make macro better
Diffstat (limited to 'src/test/gen/crypto_gen.cpp')
-rw-r--r--src/test/gen/crypto_gen.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/gen/crypto_gen.cpp b/src/test/gen/crypto_gen.cpp
new file mode 100644
index 0000000000..ca8c65806f
--- /dev/null
+++ b/src/test/gen/crypto_gen.cpp
@@ -0,0 +1,19 @@
+// Copyright (c) 2018 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <test/gen/crypto_gen.h>
+
+#include <key.h>
+
+#include <rapidcheck/gen/Arbitrary.h>
+#include <rapidcheck/Gen.h>
+#include <rapidcheck/gen/Predicate.h>
+#include <rapidcheck/gen/Container.h>
+
+/** Generates 1 to 20 keys for OP_CHECKMULTISIG */
+rc::Gen<std::vector<CKey>> MultisigKeys()
+{
+ return rc::gen::suchThat(rc::gen::arbitrary<std::vector<CKey>>(), [](const std::vector<CKey>& keys) {
+ return keys.size() >= 1 && keys.size() <= 15;
+ });
+};