unit tests: OOB indexes & adding subaddress
Tests for checking proper error throwing for out-of-bounds subaddress indexes, and proper addition of subaddresses. Signed-off-by: Cole Lightfighter <cole@onicsla.bz>
This commit is contained in:
parent
4fd6a3d27f
commit
4fb7794651
|
@ -72,7 +72,6 @@ class WalletSubaddress : public ::testing::Test
|
|||
boost::filesystem::remove(wallet_keys_file);
|
||||
}
|
||||
|
||||
|
||||
tools::wallet2 w1;
|
||||
std::string path_working_dir = ".";
|
||||
std::string path_test_wallet = "test_wallet";
|
||||
|
@ -86,7 +85,34 @@ class WalletSubaddress : public ::testing::Test
|
|||
const cryptonote::subaddress_index subaddress_index = {major_index, minor_index};
|
||||
};
|
||||
|
||||
TEST_F(WalletSubaddress, AddRow)
|
||||
TEST_F(WalletSubaddress, GetSubaddressLabel)
|
||||
{
|
||||
EXPECT_EQ(test_label, w1.get_subaddress_label(subaddress_index));
|
||||
}
|
||||
|
||||
TEST_F(WalletSubaddress, AddSubaddress)
|
||||
{
|
||||
std::string label = "test adding subaddress";
|
||||
w1.add_subaddress(0, label);
|
||||
EXPECT_EQ(label, w1.get_subaddress_label({0, 1}));
|
||||
}
|
||||
|
||||
TEST_F(WalletSubaddress, OutOfBoundsIndexes)
|
||||
{
|
||||
try
|
||||
{
|
||||
w1.get_subaddress_label({1,0});
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
EXPECT_STREQ("index_major is out of bound", e.what());
|
||||
}
|
||||
try
|
||||
{
|
||||
w1.get_subaddress_label({0,2});
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
EXPECT_STREQ("index.minor is out of bound", e.what());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue