2323
2424/* This is basically the same as test-middle-pgsql, but with flat nodes. */
2525
26- void run_tests (options_t options, const std::string cache_type) {
27- options.append = false ;
28- options.create = true ;
29- options.flat_node_cache_enabled = true ;
30- // flat nodes truncates the file each time it's started, so we can reuse the same file
31- options.flat_node_file = boost::optional<std::string>(FLAT_NODES_FILE_NAME);
32-
33- {
34- test_middle_helper<middle_pgsql_t > t (options);
35-
36- if (t.test_node_set () != 0 ) {
37- throw std::runtime_error (" test_node_set failed." );
38- }
39- }
40-
41- {
42- test_middle_helper<middle_pgsql_t > t (options);
43-
44- if (t.test_nodes_comprehensive_set () != 0 ) {
45- throw std::runtime_error (" test_nodes_comprehensive_set failed." );
46- }
47- }
48-
49- /* This should work, but doesn't. More tests are needed that look at updates
26+ void run_tests (options_t options)
27+ {
28+ options.append = false ;
29+ options.create = true ;
30+ options.flat_node_cache_enabled = true ;
31+ // flat nodes truncates the file each time it's started, so we can reuse the same file
32+ options.flat_node_file = boost::optional<std::string>(FLAT_NODES_FILE_NAME);
33+
34+ {
35+ test_middle_helper<middle_pgsql_t > t (options);
36+
37+ if (t.test_node_set () != 0 ) {
38+ throw std::runtime_error (" test_node_set failed." );
39+ }
40+ }
41+
42+ {
43+ test_middle_helper<middle_pgsql_t > t (options);
44+
45+ if (t.test_nodes_comprehensive_set () != 0 ) {
46+ throw std::runtime_error (" test_nodes_comprehensive_set failed." );
47+ }
48+ }
49+
50+ /* This should work, but doesn't. More tests are needed that look at updates
5051 without the complication of ways.
5152 */
52- {
53- // First make sure we have an empty table.
54- { test_middle_helper<middle_pgsql_t > t (options); }
53+ {
54+ // First make sure we have an empty table.
55+ {
56+ test_middle_helper<middle_pgsql_t > t (options);
57+ }
5558
56- // Switch to append mode because this tests updates
57- options.append = true ;
58- options.create = false ;
59+ // Switch to append mode because this tests updates
60+ options.append = true ;
61+ options.create = false ;
5962
60- test_middle_helper<middle_pgsql_t > t (options);
63+ test_middle_helper<middle_pgsql_t > t (options);
6164
62- t.commit ();
65+ t.commit ();
6366
64- if (t.test_way_set () != 0 ) {
65- throw std::runtime_error (" test_way_set failed." );
66- }
67- }
67+ if (t.test_way_set () != 0 ) {
68+ throw std::runtime_error (" test_way_set failed." );
69+ }
70+ }
6871}
6972int main (int argc, char *argv[]) {
70- std::unique_ptr<pg::tempdb> db;
73+ (void )argc;
74+ (void )argv;
75+ std::unique_ptr<pg::tempdb> db;
7176
72- try {
73- db.reset (new pg::tempdb);
77+ try {
78+ db.reset (new pg::tempdb);
7479 } catch (const std::exception &e) {
7580 std::cerr << " Unable to setup database: " << e.what () << " \n " ;
7681 return 77 ; // <-- code to skip this test.
@@ -89,15 +94,15 @@ int main(int argc, char *argv[]) {
8994 cleanup::file flat_nodes_file (FLAT_NODES_FILE_NAME);
9095
9196 options.alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE; // what you get with optimized
92- run_tests (options, " optimized " );
97+ run_tests (options);
9398 options.alloc_chunkwise = ALLOC_SPARSE;
94- run_tests (options, " sparse " );
99+ run_tests (options);
95100
96101 options.alloc_chunkwise = ALLOC_DENSE;
97- run_tests (options, " dense " );
102+ run_tests (options);
98103
99104 options.alloc_chunkwise = ALLOC_DENSE | ALLOC_DENSE_CHUNK; // what you get with chunk
100- run_tests (options, " chunk " );
105+ run_tests (options);
101106
102107 } catch (const std::exception &e) {
103108 std::cerr << " ERROR: " << e.what () << std::endl;
0 commit comments