MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/dbwrapper_tests.cpp:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup)
24
25BOOST_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
44BOOST_AUTO_TEST_CASE(dbwrapper_basic_data)
45{

Callers

nothing calls this directly

Calls 15

InsecureRand256Function · 0.85
is_null_keyFunction · 0.85
InsecureRand32Function · 0.85
InsecureRandBoolFunction · 0.85
InsecureRandBitsFunction · 0.85
create_directoriesFunction · 0.85
existsFunction · 0.85
WriteMethod · 0.45
ReadMethod · 0.45
ToStringMethod · 0.45
EraseMethod · 0.45
WriteBatchMethod · 0.45

Tested by

no test coverage detected