Skip to content

Commit

Permalink
[c++] Fix typo in test/unit_soma_dense_ndarray.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Aug 17, 2024
1 parent bdba3c3 commit d06f11d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion libtiledbsoma/src/soma/soma_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ std::unique_ptr<SOMAObject> SOMAObject::open(
const std::optional<std::string> SOMAObject::type() {
auto soma_object_type = this->get_metadata("soma_object_type");

if (!soma_object_type.has_value())
if (!soma_object_type.has_value()) {
return std::nullopt;
}

const char* dtype = (const char*)std::get<MetadataInfo::value>(
*soma_object_type);
Expand Down
21 changes: 19 additions & 2 deletions libtiledbsoma/test/unit_soma_dense_ndarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ TEST_CASE("SOMADenseNDArray: basic") {
auto soma_dense = SOMADenseNDArray::open(uri, OpenMode::read, ctx);
REQUIRE(soma_dense->uri() == uri);
REQUIRE(soma_dense->ctx() == ctx);
REQUIRE(soma_dense->type() == "SOMADenseNDArray");

REQUIRE(soma_dense->type().has_value());
REQUIRE(soma_dense->type().value() == "SOMADenseNDArray");

REQUIRE(soma_dense->is_sparse() == false);
REQUIRE(soma_dense->soma_data_type() == "l");
auto schema = soma_dense->tiledb_schema();
Expand Down Expand Up @@ -118,7 +121,7 @@ TEST_CASE("SOMADenseNDArray: metadata") {
std::string uri = "mem://unit-test-dense-ndarray";

auto index_columns = helper::create_column_index_info();
SOMASparseNDArray::create(
SOMADenseNDArray::create(
uri,
"l",
ArrowTable(
Expand All @@ -128,6 +131,20 @@ TEST_CASE("SOMADenseNDArray: metadata") {
TimestampRange(0, 2));

auto soma_dense = SOMADenseNDArray::open(
uri, OpenMode::write, ctx, {}, ResultOrder::automatic);

// TODO: task this out separately.
// When I open with timestamp range (3,3) I still see the .has_value() is
// false. This appears to have to do with the timestamp at which
// soma_object_type metadata was set on create, which may not have been
// timestamp t=2 as intended ...
REQUIRE(soma_dense->is_sparse() == false);
REQUIRE(soma_dense->type().has_value());
REQUIRE(soma_dense->type().value() == "SOMADenseNDArray");

soma_dense->close();

soma_dense = SOMADenseNDArray::open(
uri,
OpenMode::write,
ctx,
Expand Down

0 comments on commit d06f11d

Please sign in to comment.