Skip to content

Commit

Permalink
Remove unused test function.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaron-zilliqa committed Sep 22, 2023
1 parent 74104e6 commit bd4d364
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 171 deletions.
8 changes: 0 additions & 8 deletions tests/Data/AccountData/Test_Transaction.cpp
Expand Up @@ -77,14 +77,6 @@ BOOST_AUTO_TEST_CASE(test1, *boost::unit_test::timeout(180)) {

BOOST_CHECK_MESSAGE(Transaction::Verify(tx1), "Signature not verified\n");

BOOST_CHECK_MESSAGE(0 == tx1.GetShardIndex(fromAddr, 0),
"Shard index > 0 when passing zero shards");

uint32_t shardSize = TestUtils::DistUint32();
tx1.GetShardIndex(
fromCheck,
shardSize); // Check against nothing, just to increase coverage

zbytes message1;
tx1.Serialize(message1, 0);

Expand Down
27 changes: 12 additions & 15 deletions tests/Incentives/test_coinbase.cpp
Expand Up @@ -96,12 +96,11 @@ BOOST_AUTO_TEST_CASE(test_coinbase_correctness) {

for (uint i = 0; i < num_test_epoch; i++) {
uint j = 0;
for (const auto& shard : dummy_shards) {
b1 = GenerateRandomBooleanVector(shard.size());
const auto& shard = dummy_shards;
b1 = GenerateRandomBooleanVector(shard.size());

b2 = GenerateRandomBooleanVector(shard.size());
dummyDS.SaveCoinbaseCore(b1, b2, shard, j++, i + 1);
}
b2 = GenerateRandomBooleanVector(shard.size());
dummyDS.SaveCoinbaseCore(b1, b2, shard, j++, i + 1);

b1 = GenerateRandomBooleanVector(dummy_ds_comm.size());
b2 = GenerateRandomBooleanVector(dummy_ds_comm.size());
Expand All @@ -118,16 +117,14 @@ BOOST_AUTO_TEST_CASE(test_coinbase_correctness) {

uint128_t totalReward = 0;

auto calcReward = [&totalReward](const auto& shard) {
for (const auto& shardMember : shard) {
const auto& pubKey = std::get<SHARD_NODE_PUBKEY>(shardMember);
const auto& address = Account::GetAddressFromPublicKey(pubKey);
const Account* account = AccountStore::GetInstance().GetAccount(address);
BOOST_CHECK_MESSAGE(account != nullptr,
"Address: " << address << " PubKey: " << pubKey
<< " did not get reward");
totalReward += account->GetBalance();
}
auto calcReward = [&totalReward](const auto& shardMember) {
const auto& pubKey = std::get<SHARD_NODE_PUBKEY>(shardMember);
const auto& address = Account::GetAddressFromPublicKey(pubKey);
const Account* account = AccountStore::GetInstance().GetAccount(address);
BOOST_CHECK_MESSAGE(account != nullptr,
"Address: " << address << " PubKey: " << pubKey
<< " did not get reward");
totalReward += account->GetBalance();
};

calcReward(dummy_ds_comm);
Expand Down
23 changes: 0 additions & 23 deletions tests/Lookup/CMakeLists.txt
Expand Up @@ -16,26 +16,3 @@ add_executable(Test_LookupNodeForTxBlock Test_LookupNodeForTxBlock.cpp)
target_include_directories(Test_LookupNodeForTxBlock PUBLIC ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(Test_LookupNodeForTxBlock PUBLIC AccountData Message Network TestUtils)
add_test(NAME Test_LookupNodeForTxBlock COMMAND Test_LookupNodeForTxBlock)



add_executable(Test_txn_send Test_txn_send.cpp)
target_include_directories(Test_txn_send PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
target_link_libraries(Test_txn_send PUBLIC Node Mediator AccountStore AccountData TestUtils)
add_test(NAME Test_txn_send COMMAND Test_txn_send)

if (${CMAKE_GENERATOR} STREQUAL "Xcode")
add_custom_command(TARGET Test_txn_send POST_BUILD
COMMAND sed -i '' 's,<LOOKUP_NODE_MODE>.*,<LOOKUP_NODE_MODE>true</LOOKUP_NODE_MODE>,' ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/constants.xml)
else()
if (APPLE)
add_custom_command(TARGET Test_txn_send POST_BUILD
COMMAND sed -i '' 's,<LOOKUP_NODE_MODE>.*,<LOOKUP_NODE_MODE>true</LOOKUP_NODE_MODE>,' constants.xml)
else()
add_custom_command(TARGET Test_txn_send POST_BUILD
COMMAND sed -i 's,<LOOKUP_NODE_MODE>.*,<LOOKUP_NODE_MODE>true</LOOKUP_NODE_MODE>,' constants.xml)
endif()
endif()

add_custom_command(TARGET Test_txn_send POST_BUILD
COMMAND echo "<nodes></nodes>" > config.xml VERBATIM)
107 changes: 0 additions & 107 deletions tests/Lookup/Test_txn_send.cpp

This file was deleted.

17 changes: 0 additions & 17 deletions tests/libTestUtils/TestUtils.cpp
Expand Up @@ -227,23 +227,6 @@ DequeOfNode GenerateRandomDSCommittee(uint32_t size) {
return ds_c;
}

Shard GenerateRandomShard(size_t size) {
Shard s;
for (size_t i = 1; i <= size; i++) {
s.push_back(std::make_tuple(GenerateRandomPubKey(PrivKey()),
GenerateRandomPeer(), DistUint16()));
}
return s;
}

DequeOfShardMembers GenerateDequeueOfShard(size_t size) {
DequeOfShardMembers dos;
for (size_t i = 1; i <= size; i++) {
dos.push_front(GenerateRandomShard(i));
}
return dos;
}

CoSignatures GenerateRandomCoSignatures() { return CoSignatures(Dist1to99()); }

auto randchar = []() -> unsigned char {
Expand Down
1 change: 0 additions & 1 deletion tests/libTestUtils/TestUtils.h
Expand Up @@ -79,7 +79,6 @@ DequeOfNode GenerateRandomDSCommittee(uint32_t);

std::vector<bool> GenerateRandomBooleanVector(size_t);

Shard GenerateRandomShard(size_t);
DequeOfShardMembers GenerateDequeueOfShard(size_t);
std::string GenerateRandomString(size_t);
zbytes GenerateRandomCharVector(size_t);
Expand Down

0 comments on commit bd4d364

Please sign in to comment.