Merge pull request #1575

b3ca0c62 unit_tests: fix portable serialization tests hardcoded data path (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-01-15 14:56:09 -05:00
commit c5be70eab4
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 5 additions and 4 deletions

View file

@ -34,6 +34,7 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
epee::string_tools::set_module_name_and_folder(argv[0]);
epee::debug::get_set_enable_assert(true, false); epee::debug::get_set_enable_assert(true, false);
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);

View file

@ -657,7 +657,7 @@ TEST(Serialization, portability_wallet)
const bool testnet = true; const bool testnet = true;
const bool restricted = false; const bool restricted = false;
tools::wallet2 w(testnet, restricted); tools::wallet2 w(testnet, restricted);
string wallet_file = "../data/wallet_9svHk1"; string wallet_file = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/wallet_9svHk1";
string password = "test"; string password = "test";
bool r = false; bool r = false;
try try
@ -777,7 +777,7 @@ TEST(Serialization, portability_wallet)
TEST(Serialization, portability_outputs) TEST(Serialization, portability_outputs)
{ {
// read file // read file
const std::string filename = "../data/outputs"; const std::string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/outputs";
std::string data; std::string data;
bool r = epee::file_io_utils::load_file_to_string(filename, data); bool r = epee::file_io_utils::load_file_to_string(filename, data);
ASSERT_TRUE(r); ASSERT_TRUE(r);
@ -892,7 +892,7 @@ TEST(Serialization, portability_outputs)
#define UNSIGNED_TX_PREFIX "Monero unsigned tx set\003" #define UNSIGNED_TX_PREFIX "Monero unsigned tx set\003"
TEST(Serialization, portability_unsigned_tx) TEST(Serialization, portability_unsigned_tx)
{ {
const string filename = "../data/unsigned_monero_tx"; const string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/unsigned_monero_tx";
std::string s; std::string s;
const bool testnet = true; const bool testnet = true;
bool r = epee::file_io_utils::load_file_to_string(filename, s); bool r = epee::file_io_utils::load_file_to_string(filename, s);
@ -1042,7 +1042,7 @@ TEST(Serialization, portability_unsigned_tx)
#define SIGNED_TX_PREFIX "Monero signed tx set\003" #define SIGNED_TX_PREFIX "Monero signed tx set\003"
TEST(Serialization, portability_signed_tx) TEST(Serialization, portability_signed_tx)
{ {
const string filename = "../data/signed_monero_tx"; const string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/signed_monero_tx";
const bool testnet = true; const bool testnet = true;
std::string s; std::string s;
bool r = epee::file_io_utils::load_file_to_string(filename, s); bool r = epee::file_io_utils::load_file_to_string(filename, s);