From f52ab26ff9382534ea510c2cfe72ff902df622b4 Mon Sep 17 00:00:00 2001 From: Ypatia Tsavliri Date: Thu, 11 Apr 2024 10:30:20 +0300 Subject: [PATCH] Fix tests --- test/src/unit-cppapi-config.cc | 22 +++++++++++++++++++++- tiledb/sm/config/config.h | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/test/src/unit-cppapi-config.cc b/test/src/unit-cppapi-config.cc index 7be58bb59d32..1a93521cdb88 100644 --- a/test/src/unit-cppapi-config.cc +++ b/test/src/unit-cppapi-config.cc @@ -34,9 +34,24 @@ #include #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& 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"; @@ -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 diff --git a/tiledb/sm/config/config.h b/tiledb/sm/config/config.h index c6d9926bfe86..9f19fd2d4780 100644 --- a/tiledb/sm/config/config.h +++ b/tiledb/sm/config/config.h @@ -61,6 +61,8 @@ 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. @@ -68,6 +70,10 @@ namespace tiledb::sm { */ class Config { friend class ConfigIter; + /** + * WhiteboxConfig makes available internals of Config for testing. + */ + friend class WhiteboxConfig; public: /* ****************************** */