Skip to content

Commit

Permalink
Add unit test for C++ SOMAMultiscaleImage
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark committed Sep 29, 2024
1 parent d1a33bd commit e2b9304
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions libtiledbsoma/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions libtiledbsoma/test/unit_soma_multiscale_image.cc
Original file line number Diff line number Diff line change
@@ -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<SOMAContext>();
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();
}

0 comments on commit e2b9304

Please sign in to comment.