@ -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 ( ) ) ;
}
}