From 9e071b00898aedd9632f105a22d976dc6dbc84b1 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 3 Apr 2020 14:58:51 +0800 Subject: test: remove rapidcheck integration and tests --- src/Makefile.test.include | 11 +------- src/test/gen/crypto_gen.cpp | 19 -------------- src/test/gen/crypto_gen.h | 63 --------------------------------------------- src/test/key_properties.cpp | 48 ---------------------------------- 4 files changed, 1 insertion(+), 140 deletions(-) delete mode 100644 src/test/gen/crypto_gen.cpp delete mode 100644 src/test/gen/crypto_gen.h delete mode 100644 src/test/key_properties.cpp (limited to 'src') diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 93c5973a21..f49c5e838c 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -245,15 +245,6 @@ BITCOIN_TESTS =\ test/validation_flush_tests.cpp \ test/versionbits_tests.cpp -if ENABLE_PROPERTY_TESTS -BITCOIN_TESTS += \ - test/key_properties.cpp - -BITCOIN_TEST_SUITE += \ - test/gen/crypto_gen.cpp \ - test/gen/crypto_gen.h -endif - if ENABLE_WALLET BITCOIN_TESTS += \ wallet/test/db_tests.cpp \ @@ -283,7 +274,7 @@ test_test_bitcoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_C $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS) test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -test_test_bitcoin_LDADD += $(BDB_LIBS) $(MINIUPNPC_LIBS) $(RAPIDCHECK_LIBS) +test_test_bitcoin_LDADD += $(BDB_LIBS) $(MINIUPNPC_LIBS) test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static if ENABLE_ZMQ 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 - -#include - -#include -#include -#include -#include - -/** Generates 1 to 20 keys for OP_CHECKMULTISIG */ -rc::Gen> MultisigKeys() -{ - return rc::gen::suchThat(rc::gen::arbitrary>(), [](const std::vector& 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 -#include -#include -#include -#include -#include -#include - -/** Generates 1 to 15 keys for OP_CHECKMULTISIG */ -rc::Gen> MultisigKeys(); - -namespace rc -{ -/** Generator for a new CKey */ -template <> -struct Arbitrary { - static Gen arbitrary() - { - return rc::gen::map([](int x) { - CKey key; - key.MakeNewKey(true); - return key; - }); - }; -}; - -/** Generator for a CPrivKey */ -template <> -struct Arbitrary { - static Gen arbitrary() - { - return gen::map(gen::arbitrary(), [](const CKey& key) { - return key.GetPrivKey(); - }); - }; -}; - -/** Generator for a new CPubKey */ -template <> -struct Arbitrary { - static Gen arbitrary() - { - return gen::map(gen::arbitrary(), [](const CKey& key) { - return key.GetPubKey(); - }); - }; -}; -/** Generates a arbitrary uint256 */ -template <> -struct Arbitrary { - static Gen 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 - -#include -#include -#include - -#include -#include -#include -#include - -#include - -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 vchSig; - key.Sign(hash, vchSig, 0); - const CPubKey& pubKey = key.GetPubKey(); - RC_ASSERT(pubKey.Verify(hash, vchSig)); -} -BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3