@@ -43,7 +43,7 @@ TEST_CASE("Persistent cache", "[NoDB]")
4343
4444 // create a new cache
4545 {
46- node_persistent_cache cache{flat_node_file, false };
46+ node_persistent_cache cache{flat_node_file, true , false };
4747
4848 // write in order
4949 write_and_read_location (&cache, 10 , 10.01 , -45.3 );
@@ -66,7 +66,7 @@ TEST_CASE("Persistent cache", "[NoDB]")
6666
6767 // reopen the cache
6868 {
69- node_persistent_cache cache{flat_node_file, false };
69+ node_persistent_cache cache{flat_node_file, false , false };
7070
7171 // read all previously written locations
7272 read_location (cache, 10 , 10.01 , -45.3 );
@@ -107,3 +107,12 @@ TEST_CASE("Persistent cache", "[NoDB]")
107107 read_location (cache, 9934 , -179.999 , 89.1 );
108108 }
109109}
110+
111+ TEST_CASE (" Opening non-existent persistent cache should fail in append mode" , " [NoDB]" )
112+ {
113+ std::string const flat_node_file =
114+ " test_middle_flat.nonexistent.flat.nodes.bin" ;
115+ testing::cleanup::file_t const flatnode_cleaner{flat_node_file};
116+
117+ REQUIRE_THROWS (node_persistent_cache (flat_node_file, false , false ));
118+ }
0 commit comments