MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / read_block

Function read_block

src/tests/checkblock_tests.cpp:22–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20BOOST_AUTO_TEST_SUITE(CheckBlock_tests)
21
22bool read_block(const std::string& filename, CBlock& block)
23{
24 namespace fs = boost::filesystem;
25 fs::path testFile = fs::current_path() / "data" / filename;
26#ifdef TEST_DATA_DIR
27 if (!fs::exists(testFile))
28 {
29 testFile = fs::path(BOOST_PP_STRINGIZE(TEST_DATA_DIR)) / filename;
30 }
31#endif
32 FILE* fp = fopen(testFile.string().c_str(), "rb");
33 if (!fp) return false;
34
35 fseek(fp, 8, SEEK_SET); // skip msgheader/size
36
37 CAutoFile filein = CAutoFile(fp, SER_DISK, CLIENT_VERSION);
38 if (!filein) return false;
39
40 filein >> block;
41
42 return true;
43}
44
45BOOST_AUTO_TEST_CASE(May15)
46{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

pathClass · 0.85
fopenFunction · 0.85
CAutoFileClass · 0.85

Tested by

no test coverage detected