From e2b9304f5c48af5fcbc25b0293239da2c9afd6e3 Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Sun, 29 Sep 2024 13:50:07 -0400 Subject: [PATCH] Add unit test for C++ SOMAMultiscaleImage --- libtiledbsoma/test/CMakeLists.txt | 1 + .../test/unit_soma_multiscale_image.cc | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 libtiledbsoma/test/unit_soma_multiscale_image.cc diff --git a/libtiledbsoma/test/CMakeLists.txt b/libtiledbsoma/test/CMakeLists.txt index 33bd4178cc..3cd301ea3b 100644 --- a/libtiledbsoma/test/CMakeLists.txt +++ b/libtiledbsoma/test/CMakeLists.txt @@ -27,6 +27,7 @@ add_executable(unit_soma unit_soma_dense_ndarray.cc unit_soma_sparse_ndarray.cc unit_soma_collection.cc + unit_soma_multiscale_image.cc test_indexer.cc # TODO: uncomment when thread_pool is enabled # unit_thread_pool.cc diff --git a/libtiledbsoma/test/unit_soma_multiscale_image.cc b/libtiledbsoma/test/unit_soma_multiscale_image.cc new file mode 100644 index 0000000000..e32231ee6b --- /dev/null +++ b/libtiledbsoma/test/unit_soma_multiscale_image.cc @@ -0,0 +1,45 @@ +/** + * @file unit_soma_multiscale_image.cc + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2024 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file manages unit tests for the SOMAMultiscaleImage class + */ +#include "common.h" + +TEST_CASE("SOMAMultiscaleImage: basic") { + auto ctx = std::make_shared(); + std::string uri = "mem://unit-test-multiscale-image-basic"; + + SOMAMultiscaleImage::create(uri, ctx, std::nullopt); + auto soma_image = SOMAMultiscaleImage::open( + uri, OpenMode::read, ctx, std::nullopt); + REQUIRE(soma_image->uri() == uri); + REQUIRE(soma_image->ctx() == ctx); + REQUIRE(soma_image->type() == "SOMAMultiscaleImage"); + soma_image->close(); +}