Skip to content

Commit

Permalink
Add test using ArraySchemaExperimental::get_enumeration_from_name aft…
Browse files Browse the repository at this point in the history
…er schema evolution
  • Loading branch information
rroelke committed Nov 12, 2024
1 parent bcaa3e5 commit 79c4eaf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/src/unit-cppapi-enumerations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,34 @@ TEST_CASE_METHOD(
REQUIRE(rc != TILEDB_OK);
}

TEST_CASE_METHOD(
CPPEnumerationFx,
"C API: ArraySchemaEvolution - Add Enumeration, retrieve with "
"ArraySchema::get_enumeration_from_name",
"[enumeration][array-schema-evolution][array-schema-get-enumeration-from-"
"name][rest]") {
create_array();

// Evolve once to add an enumeration.
ArraySchemaEvolution ase(ctx_);
std::vector<std::string> var_values{"one", "two", "three"};
auto var_enmr = Enumeration::create(ctx_, "ase_var_enmr", var_values);
ase.add_enumeration(var_enmr);
auto attr4 = Attribute::create<uint16_t>(ctx_, "attr4");
AttributeExperimental::set_enumeration_name(ctx_, attr4, "ase_var_enmr");
ase.add_attribute(attr4);
// Apply evolution to the array and reopen.
ase.array_evolve(uri_);

auto schema = Array::load_schema(ctx_, uri_);
auto actual_enumeration = ArraySchemaExperimental::get_enumeration_from_name(
ctx_, schema, "ase_var_enmr");

CHECK(test::is_equivalent_enumeration(
*var_enmr.ptr()->enumeration(),
*actual_enumeration.ptr()->enumeration()));
}

TEST_CASE_METHOD(
CPPEnumerationFx,
"CPP: Enumeration Query - Basic",
Expand Down

0 comments on commit 79c4eaf

Please sign in to comment.