Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/test/walletdb_tests.cpp
Show All 16 Lines | struct WalletDBTestingSetup : public TestingSetup { | ||||
} | } | ||||
~WalletDBTestingSetup() { | ~WalletDBTestingSetup() { | ||||
bitdb.Flush(true); | bitdb.Flush(true); | ||||
bitdb.Reset(); | bitdb.Reset(); | ||||
} | } | ||||
}; | }; | ||||
static std::unique_ptr<CWalletDB> TmpDB(const boost::filesystem::path &pathTemp, | static std::unique_ptr<CWalletDB> TmpDB(const fs::path &pathTemp, | ||||
const std::string &testname) { | const std::string &testname) { | ||||
boost::filesystem::path dir = pathTemp / testname; | fs::path dir = pathTemp / testname; | ||||
BOOST_CHECK_MESSAGE(boost::filesystem::create_directory(dir), | BOOST_CHECK_MESSAGE(fs::create_directory(dir), | ||||
"Unable to create a directory for test " + testname); | "Unable to create a directory for test " + testname); | ||||
boost::filesystem::path path = | fs::path path = | ||||
dir / strprintf("testwallet%i", static_cast<int>(GetRand(1000000))); | dir / strprintf("testwallet%i", static_cast<int>(GetRand(1000000))); | ||||
return std::unique_ptr<CWalletDB>(new CWalletDB(path.string(), "cr+")); | return std::unique_ptr<CWalletDB>(new CWalletDB(path.string(), "cr+")); | ||||
} | } | ||||
static std::unique_ptr<CWallet> LoadWallet(CWalletDB *db) { | static std::unique_ptr<CWallet> LoadWallet(CWalletDB *db) { | ||||
std::unique_ptr<CWallet> wallet(new CWallet); | std::unique_ptr<CWallet> wallet(new CWallet); | ||||
DBErrors res = db->LoadWallet(wallet.get()); | DBErrors res = db->LoadWallet(wallet.get()); | ||||
BOOST_CHECK(res == DB_LOAD_OK); | BOOST_CHECK(res == DB_LOAD_OK); | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |