Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
grow_shrink.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <chainbase/chainbase.hpp>
Include dependency graph for grow_shrink.cpp:

Go to the source code of this file.

Functions

 BOOST_DATA_TEST_CASE (grow_shrink, boost::unit_test::data::make(test_modes), map_mode)
 

Variables

const pinnable_mapped_file::map_mode test_modes [] = {pinnable_mapped_file::map_mode::mapped, pinnable_mapped_file::map_mode::heap}
 

Function Documentation

◆ BOOST_DATA_TEST_CASE()

BOOST_DATA_TEST_CASE ( grow_shrink ,
boost::unit_test::data::make(test_modes) ,
map_mode  )

Definition at line 10 of file grow_shrink.cpp.

10 {
11 boost::filesystem::path temp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
12 try {
13 const size_t db_start_size = 8u*1024u*1024u;
14 const size_t db_grow_size = 16u*1024u*1024u;
15 const size_t db_shrunk_size = 2u*1024u*1024u;
16
17 {
18 chainbase::database db(temp, database::read_write, db_start_size, false, map_mode);
19 }
20 {
21 chainbase::database db(temp, database::read_write, db_grow_size, false, map_mode);
22 BOOST_CHECK(db.get_free_memory() > db_start_size);
23 }
24 {
25 chainbase::database db(temp, database::read_write, db_shrunk_size, false, map_mode);
26 BOOST_CHECK(db.get_free_memory() > db_start_size);
27 }
28
29 } catch(...) {
30 bfs::remove_all(temp);
31 throw;
32 }
33 bfs::remove_all(temp);
34}
Here is the call graph for this function:

Variable Documentation

◆ test_modes

const pinnable_mapped_file::map_mode test_modes[] = {pinnable_mapped_file::map_mode::mapped, pinnable_mapped_file::map_mode::heap}

Definition at line 8 of file grow_shrink.cpp.

8{pinnable_mapped_file::map_mode::mapped, pinnable_mapped_file::map_mode::heap};