| 24 | BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup) |
| 25 | |
| 26 | BOOST_AUTO_TEST_CASE(dbwrapper) |
| 27 | { |
| 28 | // Perform tests both obfuscated and non-obfuscated. |
| 29 | for (bool obfuscate : {false, true}) { |
| 30 | fs::path ph = SetDataDir(std::string("dbwrapper").append(obfuscate ? "_true" : "_false")); |
| 31 | CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); |
| 32 | char key = 'k'; |
| 33 | uint256 in = InsecureRand256(); |
| 34 | uint256 res; |
| 35 | |
| 36 | // Ensure that we're doing real obfuscation when obfuscate=true |
| 37 | BOOST_CHECK(obfuscate != is_null_key(dbwrapper_private::GetObfuscateKey(dbw))); |
| 38 | |
| 39 | BOOST_CHECK(dbw.Write(key, in)); |
| 40 | BOOST_CHECK(dbw.Read(key, res)); |
| 41 | BOOST_CHECK_EQUAL(res.ToString(), in.ToString()); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // Test batch operations |
| 46 | BOOST_AUTO_TEST_CASE(dbwrapper_batch) |
nothing calls this directly
no test coverage detected