Fix new tests relying on deterministic signatures (#1363)

This commit is contained in:
Lee Bousfield 2018-11-08 18:32:34 -06:00 committed by GitHub
commit f7a505ba36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -420,7 +420,9 @@ TEST (block_uniquer, single)
{
rai::keypair key;
auto block1 (std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key.prv, key.pub, 0));
auto block2 (std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key.prv, key.pub, 0));
auto block2 (std::make_shared<rai::state_block> (*block1));
ASSERT_NE (block1, block2);
ASSERT_EQ (*block1, *block2);
std::weak_ptr<rai::state_block> block3 (block2);
ASSERT_NE (nullptr, block3.lock ());
rai::block_uniquer uniquer;

View file

@ -75,7 +75,7 @@ TEST (vote_uniquer, same_vote)
rai::vote_uniquer uniquer (block_uniquer);
rai::keypair key;
auto vote1 (std::make_shared<rai::vote> (key.pub, key.prv, 0, std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key.prv, key.pub, 0)));
auto vote2 (std::make_shared<rai::vote> (key.pub, key.prv, 0, std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key.prv, key.pub, 0)));
auto vote2 (std::make_shared<rai::vote> (*vote1));
ASSERT_EQ (vote1, uniquer.unique (vote1));
ASSERT_EQ (vote1, uniquer.unique (vote2));
}
@ -87,8 +87,10 @@ TEST (vote_uniquer, same_block)
rai::vote_uniquer uniquer (block_uniquer);
rai::keypair key1;
rai::keypair key2;
auto vote1 (std::make_shared<rai::vote> (key1.pub, key1.prv, 0, std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key1.prv, key1.pub, 0)));
auto vote2 (std::make_shared<rai::vote> (key2.pub, key2.prv, 0, std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key1.prv, key1.pub, 0)));
auto block1 (std::make_shared<rai::state_block> (0, 0, 0, 0, 0, key1.prv, key1.pub, 0));
auto block2 (std::make_shared<rai::state_block> (*block1));
auto vote1 (std::make_shared<rai::vote> (key1.pub, key1.prv, 0, block1));
auto vote2 (std::make_shared<rai::vote> (key1.pub, key1.prv, 0, block2));
ASSERT_EQ (vote1, uniquer.unique (vote1));
ASSERT_EQ (vote2, uniquer.unique (vote2));
ASSERT_NE (vote1, vote2);
@ -104,7 +106,7 @@ TEST (vote_uniquer, vbh_one)
std::vector<rai::block_hash> hashes;
hashes.push_back (block->hash ());
auto vote1 (std::make_shared<rai::vote> (key.pub, key.prv, 0, hashes));
auto vote2 (std::make_shared<rai::vote> (key.pub, key.prv, 0, hashes));
auto vote2 (std::make_shared<rai::vote> (*vote1));
ASSERT_EQ (vote1, uniquer.unique (vote1));
ASSERT_EQ (vote1, uniquer.unique (vote2));
}