Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatia committed Apr 11, 2024
1 parent a4ff1d3 commit f52ab26
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/src/unit-cppapi-config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,24 @@

#include <test/support/tdb_catch.h>
#include "test/support/src/helpers.h"
#include "tiledb/api/c_api/config/config_api_internal.h"
#include "tiledb/sm/c_api/tiledb_serialization.h"
#include "tiledb/sm/cpp_api/tiledb"

using namespace tiledb::sm;

class tiledb::sm::WhiteboxConfig {
public:
WhiteboxConfig(tiledb::sm::Config config)
: config_(config){};

const std::map<std::string, std::string>& get_all_params() const {
return config_.param_values();
}

tiledb::sm::Config config_;
};

TEST_CASE("C++ API: Config", "[cppapi][config]") {
tiledb::Config config;
config["foo"] = "bar";
Expand Down Expand Up @@ -159,7 +174,12 @@ TEST_CASE("C++ API: Config Serialization", "[cppapi][config][serialization]") {
CHECK(rc == TILEDB_OK);
tiledb::Config config2(&config2_ptr);

bool config_equal = config1 == config2;
auto cfg1 = config1.ptr().get()->config();
auto cfg2 = config2.ptr().get()->config();
// Check that the deserialized config already contains the values set in
// environment variables
bool config_equal = cfg1.get_all_params_from_config_or_env() ==
WhiteboxConfig(cfg2).get_all_params();
CHECK(config_equal);

// Check for inequality
Expand Down
6 changes: 6 additions & 0 deletions tiledb/sm/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ using namespace tiledb::common;

namespace tiledb::sm {

class WhiteboxConfig;

/**
* This class manages the TileDB configuration options.
* It is implemented as a simple map from string to string.
* Parsing to appropriate types happens on demand.
*/
class Config {
friend class ConfigIter;
/**
* WhiteboxConfig makes available internals of Config for testing.
*/
friend class WhiteboxConfig;

public:
/* ****************************** */
Expand Down

0 comments on commit f52ab26

Please sign in to comment.