diff options
author | fanquake <fanquake@gmail.com> | 2020-04-03 14:58:51 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-04-03 22:47:59 +0800 |
commit | 9e071b00898aedd9632f105a22d976dc6dbc84b1 (patch) | |
tree | dcd9fe18d5f554c5e794776da085f52fd91d1b57 /src/test | |
parent | 08c4994969be20ab268faed2793fb4b9f17722ee (diff) |
test: remove rapidcheck integration and tests
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/gen/crypto_gen.cpp | 19 | ||||
-rw-r--r-- | src/test/gen/crypto_gen.h | 63 | ||||
-rw-r--r-- | src/test/key_properties.cpp | 48 |
3 files changed, 0 insertions, 130 deletions
diff --git a/src/test/gen/crypto_gen.cpp b/src/test/gen/crypto_gen.cpp deleted file mode 100644 index ca8c65806f..0000000000 --- a/src/test/gen/crypto_gen.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// 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; - }); -}; diff --git a/src/test/gen/crypto_gen.h b/src/test/gen/crypto_gen.h deleted file mode 100644 index 7c2fb0350f..0000000000 --- a/src/test/gen/crypto_gen.h +++ /dev/null @@ -1,63 +0,0 @@ -// 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. -#ifndef BITCOIN_TEST_GEN_CRYPTO_GEN_H -#define BITCOIN_TEST_GEN_CRYPTO_GEN_H - -#include <key.h> -#include <random.h> -#include <uint256.h> -#include <rapidcheck/gen/Arbitrary.h> -#include <rapidcheck/Gen.h> -#include <rapidcheck/gen/Create.h> -#include <rapidcheck/gen/Numeric.h> - -/** Generates 1 to 15 keys for OP_CHECKMULTISIG */ -rc::Gen<std::vector<CKey>> MultisigKeys(); - -namespace rc -{ -/** Generator for a new CKey */ -template <> -struct Arbitrary<CKey> { - static Gen<CKey> arbitrary() - { - return rc::gen::map<int>([](int x) { - CKey key; - key.MakeNewKey(true); - return key; - }); - }; -}; - -/** Generator for a CPrivKey */ -template <> -struct Arbitrary<CPrivKey> { - static Gen<CPrivKey> arbitrary() - { - return gen::map(gen::arbitrary<CKey>(), [](const CKey& key) { - return key.GetPrivKey(); - }); - }; -}; - -/** Generator for a new CPubKey */ -template <> -struct Arbitrary<CPubKey> { - static Gen<CPubKey> arbitrary() - { - return gen::map(gen::arbitrary<CKey>(), [](const CKey& key) { - return key.GetPubKey(); - }); - }; -}; -/** Generates a arbitrary uint256 */ -template <> -struct Arbitrary<uint256> { - static Gen<uint256> arbitrary() - { - return rc::gen::just(GetRandHash()); - }; -}; -} //namespace rc -#endif diff --git a/src/test/key_properties.cpp b/src/test/key_properties.cpp deleted file mode 100644 index 0e45a2549d..0000000000 --- a/src/test/key_properties.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018-2019 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 <key.h> - -#include <uint256.h> -#include <test/util/setup_common.h> -#include <vector> - -#include <boost/test/unit_test.hpp> -#include <rapidcheck/boost_test.h> -#include <rapidcheck/gen/Arbitrary.h> -#include <rapidcheck/Gen.h> - -#include <test/gen/crypto_gen.h> - -BOOST_FIXTURE_TEST_SUITE(key_properties, BasicTestingSetup) - -/** Check CKey uniqueness */ -RC_BOOST_PROP(key_uniqueness, (const CKey& key1, const CKey& key2)) -{ - RC_ASSERT(!(key1 == key2)); -} - -/** Verify that a private key generates the correct public key */ -RC_BOOST_PROP(key_generates_correct_pubkey, (const CKey& key)) -{ - CPubKey pubKey = key.GetPubKey(); - RC_ASSERT(key.VerifyPubKey(pubKey)); -} - -/** Create a CKey using the 'Set' function must give us the same key */ -RC_BOOST_PROP(key_set_symmetry, (const CKey& key)) -{ - CKey key1; - key1.Set(key.begin(), key.end(), key.IsCompressed()); - RC_ASSERT(key1 == key); -} - -/** Create a CKey, sign a piece of data, then verify it with the public key */ -RC_BOOST_PROP(key_sign_symmetry, (const CKey& key, const uint256& hash)) -{ - std::vector<unsigned char> vchSig; - key.Sign(hash, vchSig, 0); - const CPubKey& pubKey = key.GetPubKey(); - RC_ASSERT(pubKey.Verify(hash, vchSig)); -} -BOOST_AUTO_TEST_SUITE_END() |