Skip to content

Commit

Permalink
unit_tests: wallet addresses as variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg033 committed Feb 27, 2018
1 parent 21f7788 commit bfe5f0a
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tests/unit_tests/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
#include "gtest/gtest.h"
using namespace std;

namespace {
static const string ADDRESS1 = "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana";
static const string ADDRESS2 = "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE";
}

struct Struct
{
Expand Down Expand Up @@ -1156,7 +1160,7 @@ TEST(Serialization, portability_unsigned_tx)
// tcd.change_dts
ASSERT_TRUE(tcd.change_dts.amount == 7784000000000);

ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, tcd.change_dts.addr) == "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, tcd.change_dts.addr) == ADDRESS1);



Expand All @@ -1168,8 +1172,8 @@ TEST(Serialization, portability_unsigned_tx)
ASSERT_TRUE(splitted_dst0.amount == 1000000000000);
ASSERT_TRUE(splitted_dst1.amount == 7784000000000);

ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst0.addr) == "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst1.addr) == "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst0.addr) == ADDRESS2);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst1.addr) == ADDRESS1);
// tcd.selected_transfers
ASSERT_TRUE(tcd.selected_transfers.size() == 2);
ASSERT_TRUE(tcd.selected_transfers.front() == 0);
Expand All @@ -1183,7 +1187,7 @@ TEST(Serialization, portability_unsigned_tx)
ASSERT_TRUE(tcd.dests.size() == 1);
auto& dest = tcd.dests[0];
ASSERT_TRUE(dest.amount == 1000000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, dest.addr) == "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, dest.addr) == ADDRESS2);
// transfers
ASSERT_TRUE(exported_txs.transfers.size() == 2);
auto& td0 = exported_txs.transfers[0];
Expand Down Expand Up @@ -1273,7 +1277,7 @@ TEST(Serialization, portability_signed_tx)
ASSERT_FALSE(ptx.dust_added_to_fee);
// ptx.change.{amount, addr}
ASSERT_TRUE(ptx.change_dts.amount == 7784000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, ptx.change_dts.addr) == "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, ptx.change_dts.addr) == ADDRESS1);

// ptx.selected_transfers
ASSERT_TRUE(ptx.selected_transfers.size() == 2);
Expand All @@ -1284,7 +1288,7 @@ TEST(Serialization, portability_signed_tx)
// ptx.dests
ASSERT_TRUE(ptx.dests.size() == 1);
ASSERT_TRUE(ptx.dests[0].amount == 1000000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, ptx.dests[0].addr) == "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, ptx.dests[0].addr) == ADDRESS2);
// ptx.construction_data
auto& tcd = ptx.construction_data;
ASSERT_TRUE(tcd.sources.size() == 2);
Expand Down Expand Up @@ -1315,15 +1319,15 @@ TEST(Serialization, portability_signed_tx)
ASSERT_TRUE(epee::string_tools::pod_to_hex(tse.mask) == "796309c7e57439028f111714bd04c8bbe22167bd2f7c04c21dc99b0c16478003");
// ptx.construction_data.change_dts
ASSERT_TRUE(tcd.change_dts.amount == 7784000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, tcd.change_dts.addr) == "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, tcd.change_dts.addr) == ADDRESS1);
// ptx.construction_data.splitted_dsts
ASSERT_TRUE(tcd.splitted_dsts.size() == 2);
auto& splitted_dst0 = tcd.splitted_dsts[0];
auto& splitted_dst1 = tcd.splitted_dsts[1];
ASSERT_TRUE(splitted_dst0.amount == 1000000000000);
ASSERT_TRUE(splitted_dst1.amount == 7784000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst0.addr) == "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst1.addr) == "F8ER6NJ6zka6keUKJjX8ry44mVaXuQeVg5dPsuW3gyWRDzxCXpwuHVkMCNmrXZEMVHMFo5zEkoNTeb95hkqWgzMDSWFvana");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst0.addr) == ADDRESS2);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, splitted_dst1.addr) == ADDRESS1);
// ptx.construction_data.selected_transfers
ASSERT_TRUE(tcd.selected_transfers.size() == 2);
ASSERT_TRUE(tcd.selected_transfers.front() == 0);
Expand All @@ -1336,7 +1340,7 @@ TEST(Serialization, portability_signed_tx)
ASSERT_TRUE(tcd.dests.size() == 1);
auto& dest = tcd.dests[0];
ASSERT_TRUE(dest.amount == 1000000000000);
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, dest.addr) == "F85wjfH5DH6Hyo27TbCG98aBDw5J7xEYpJL2QC2cj5TTdinKu3XE6z1Uojry6aa9py94H9RCnQu4gdM6ywERTvCHVfDcMoE");
ASSERT_TRUE(cryptonote::get_account_address_as_str(testnet, dest.addr) == ADDRESS2);
// key_images
ASSERT_TRUE(exported_txs.key_images.size() == 2);
auto& ki0 = exported_txs.key_images[0];
Expand Down

0 comments on commit bfe5f0a

Please sign in to comment.