Пример #1
0
void run_tests(const options_t options, const std::string cache_type) {
  {
    middle_ram_t mid_ram;
    output_null_t out_test(&mid_ram, options);

    mid_ram.start(&options);

    if (test_node_set(&mid_ram) != 0) { throw std::runtime_error("test_node_set failed with " + cache_type + " cache."); }
    mid_ram.commit();
    mid_ram.stop();
  }
  {
    middle_ram_t mid_ram;
    output_null_t out_test(&mid_ram, options);

    mid_ram.start(&options);

    if (test_nodes_comprehensive_set(&mid_ram) != 0) { throw std::runtime_error("test_nodes_comprehensive_set failed with " + cache_type + " cache."); }
    mid_ram.commit();
    mid_ram.stop();
  }
  {
    middle_ram_t mid_ram;
    output_null_t out_test(&mid_ram, options);

    mid_ram.start(&options);

    if (test_way_set(&mid_ram) != 0) { throw std::runtime_error("test_way_set failed with " + cache_type + " cache."); }
    mid_ram.commit();
    mid_ram.stop();
  }
}
Пример #2
0
void run_tests(options_t options, const std::string cache_type) {
  options.append = false;
  options.create = true;
  options.flat_node_cache_enabled = true;
  // flat nodes truncates the file each time it's started, so we can reuse the same file
  options.flat_node_file = boost::optional<std::string>(FLAT_NODES_FILE_NAME);

  {
    middle_pgsql_t mid_pgsql;
    output_null_t out_test(&mid_pgsql, options);

    mid_pgsql.start(&options);

    if (test_node_set(&mid_pgsql) != 0) { throw std::runtime_error("test_node_set failed."); }

    mid_pgsql.commit();
    mid_pgsql.stop();
  }
  {
    middle_pgsql_t mid_pgsql;
    output_null_t out_test(&mid_pgsql, options);

    mid_pgsql.start(&options);

    if (test_nodes_comprehensive_set(&mid_pgsql) != 0) { throw std::runtime_error("test_nodes_comprehensive_set failed."); }

    mid_pgsql.commit();
    mid_pgsql.stop();
  }
  /* This should work, but doesn't. More tests are needed that look at updates
     without the complication of ways.
  */
/*  {
    middle_pgsql_t mid_pgsql;
    output_null_t out_test(&mid_pgsql, options);

    mid_pgsql.start(&options);
    mid_pgsql.commit();
    mid_pgsql.stop();
    // Switch to append mode because this tests updates
    options.append = true;
    options.create = false;
    mid_pgsql.start(&options);
    if (test_way_set(&mid_pgsql) != 0) { throw std::runtime_error("test_way_set failed."); }

    mid_pgsql.commit();
    mid_pgsql.stop();
  }*/
}