From d06f11d4c3abde348119532f75a7d687d9f3bee4 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sat, 17 Aug 2024 13:56:06 -0400 Subject: [PATCH] [c++] Fix typo in `test/unit_soma_dense_ndarray.cc` --- libtiledbsoma/src/soma/soma_object.cc | 3 ++- libtiledbsoma/test/unit_soma_dense_ndarray.cc | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_object.cc b/libtiledbsoma/src/soma/soma_object.cc index a2b5093bd9..d503c6f539 100644 --- a/libtiledbsoma/src/soma/soma_object.cc +++ b/libtiledbsoma/src/soma/soma_object.cc @@ -88,8 +88,9 @@ std::unique_ptr SOMAObject::open( const std::optional 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( *soma_object_type); diff --git a/libtiledbsoma/test/unit_soma_dense_ndarray.cc b/libtiledbsoma/test/unit_soma_dense_ndarray.cc index 09db1ec5bc..74dcfa68d8 100644 --- a/libtiledbsoma/test/unit_soma_dense_ndarray.cc +++ b/libtiledbsoma/test/unit_soma_dense_ndarray.cc @@ -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(); @@ -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( @@ -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,