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