Changeset View
Changeset View
Standalone View
Standalone View
src/test/key_tests.cpp
| // Copyright (c) 2012-2015 The Bitcoin Core developers | // Copyright (c) 2012-2015 The Bitcoin Core developers | ||||
| // Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
| #include "config.h" | |||||
| #include "key.h" | #include "key.h" | ||||
| #include "base58.h" | #include "base58.h" | ||||
| #include "dstencode.h" | #include "dstencode.h" | ||||
| #include "script/script.h" | #include "script/script.h" | ||||
| #include "test/test_bitcoin.h" | #include "test/test_bitcoin.h" | ||||
| #include "uint256.h" | #include "uint256.h" | ||||
| #include "util.h" | #include "util.h" | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(key_test1) { | ||||
| BOOST_CHECK(key2.VerifyPubKey(pubkey2)); | BOOST_CHECK(key2.VerifyPubKey(pubkey2)); | ||||
| BOOST_CHECK(!key2.VerifyPubKey(pubkey2C)); | BOOST_CHECK(!key2.VerifyPubKey(pubkey2C)); | ||||
| BOOST_CHECK(!key2C.VerifyPubKey(pubkey1)); | BOOST_CHECK(!key2C.VerifyPubKey(pubkey1)); | ||||
| BOOST_CHECK(!key2C.VerifyPubKey(pubkey1C)); | BOOST_CHECK(!key2C.VerifyPubKey(pubkey1C)); | ||||
| BOOST_CHECK(!key2C.VerifyPubKey(pubkey2)); | BOOST_CHECK(!key2C.VerifyPubKey(pubkey2)); | ||||
| BOOST_CHECK(key2C.VerifyPubKey(pubkey2C)); | BOOST_CHECK(key2C.VerifyPubKey(pubkey2C)); | ||||
| const CChainParams &chainParams = Params(); | const Config &config = GetConfig(); | ||||
| BOOST_CHECK(DecodeDestination(addr1, chainParams) == | BOOST_CHECK(DecodeDestination(addr1, config) == | ||||
| CTxDestination(pubkey1.GetID())); | CTxDestination(pubkey1.GetID())); | ||||
| BOOST_CHECK(DecodeDestination(addr2, chainParams) == | BOOST_CHECK(DecodeDestination(addr2, config) == | ||||
| CTxDestination(pubkey2.GetID())); | CTxDestination(pubkey2.GetID())); | ||||
| BOOST_CHECK(DecodeDestination(addr1C, chainParams) == | BOOST_CHECK(DecodeDestination(addr1C, config) == | ||||
| CTxDestination(pubkey1C.GetID())); | CTxDestination(pubkey1C.GetID())); | ||||
| BOOST_CHECK(DecodeDestination(addr2C, chainParams) == | BOOST_CHECK(DecodeDestination(addr2C, config) == | ||||
| CTxDestination(pubkey2C.GetID())); | CTxDestination(pubkey2C.GetID())); | ||||
| for (int n = 0; n < 16; n++) { | for (int n = 0; n < 16; n++) { | ||||
| std::string strMsg = strprintf("Very secret message %i: 11", n); | std::string strMsg = strprintf("Very secret message %i: 11", n); | ||||
| uint256 hashMsg = Hash(strMsg.begin(), strMsg.end()); | uint256 hashMsg = Hash(strMsg.begin(), strMsg.end()); | ||||
| // normal signatures | // normal signatures | ||||
| ▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines | |||||