|
|
|
@ -47,6 +47,7 @@
|
|
|
|
|
#include "serialization/binary_utils.h"
|
|
|
|
|
#include "wallet/wallet2.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include "unit_tests_utils.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
struct Struct
|
|
|
|
@ -671,12 +672,12 @@ TEST(Serialization, portability_wallet)
|
|
|
|
|
const bool testnet = true;
|
|
|
|
|
const bool restricted = false;
|
|
|
|
|
tools::wallet2 w(testnet, restricted);
|
|
|
|
|
string wallet_file = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/wallet_9svHk1";
|
|
|
|
|
const boost::filesystem::path wallet_file = unit_test::data_dir / "wallet_9svHk1";
|
|
|
|
|
string password = "test";
|
|
|
|
|
bool r = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
w.load(wallet_file, password);
|
|
|
|
|
w.load(wallet_file.native(), password);
|
|
|
|
|
r = true;
|
|
|
|
|
}
|
|
|
|
|
catch (const exception& e)
|
|
|
|
@ -791,9 +792,9 @@ TEST(Serialization, portability_wallet)
|
|
|
|
|
TEST(Serialization, portability_outputs)
|
|
|
|
|
{
|
|
|
|
|
// read file
|
|
|
|
|
const std::string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/outputs";
|
|
|
|
|
const boost::filesystem::path filename = unit_test::data_dir / "outputs";
|
|
|
|
|
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.native(), data);
|
|
|
|
|
ASSERT_TRUE(r);
|
|
|
|
|
const size_t magiclen = strlen(OUTPUT_EXPORT_FILE_MAGIC);
|
|
|
|
|
ASSERT_FALSE(data.size() < magiclen || memcmp(data.data(), OUTPUT_EXPORT_FILE_MAGIC, magiclen));
|
|
|
|
@ -906,10 +907,10 @@ TEST(Serialization, portability_outputs)
|
|
|
|
|
#define UNSIGNED_TX_PREFIX "Monero unsigned tx set\003"
|
|
|
|
|
TEST(Serialization, portability_unsigned_tx)
|
|
|
|
|
{
|
|
|
|
|
const string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/unsigned_monero_tx";
|
|
|
|
|
const boost::filesystem::path filename = unit_test::data_dir / "unsigned_monero_tx";
|
|
|
|
|
std::string s;
|
|
|
|
|
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.native(), s);
|
|
|
|
|
ASSERT_TRUE(r);
|
|
|
|
|
const size_t magiclen = strlen(UNSIGNED_TX_PREFIX);
|
|
|
|
|
ASSERT_FALSE(strncmp(s.c_str(), UNSIGNED_TX_PREFIX, magiclen));
|
|
|
|
@ -1054,10 +1055,10 @@ TEST(Serialization, portability_unsigned_tx)
|
|
|
|
|
#define SIGNED_TX_PREFIX "Monero signed tx set\003"
|
|
|
|
|
TEST(Serialization, portability_signed_tx)
|
|
|
|
|
{
|
|
|
|
|
const string filename = epee::string_tools::get_current_module_folder() + "/../../../../tests/data/signed_monero_tx";
|
|
|
|
|
const boost::filesystem::path filename = unit_test::data_dir / "signed_monero_tx";
|
|
|
|
|
const bool testnet = true;
|
|
|
|
|
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.native(), s);
|
|
|
|
|
ASSERT_TRUE(r);
|
|
|
|
|
const size_t magiclen = strlen(SIGNED_TX_PREFIX);
|
|
|
|
|
ASSERT_FALSE(strncmp(s.c_str(), SIGNED_TX_PREFIX, magiclen));
|
|
|
|
|