Skip to content

Commit

Permalink
Add test for printing multidimensional index
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Mar 9, 2024
1 parent 584f33a commit 7fa2b81
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/unit_test/TestViewOutOfBoundsAccess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@

#include <gtest/gtest.h>

namespace {

TEST(TEST_CATEGORY, append_formated_multidimensional_index) {
using Kokkos::Impl::append_formated_multidimensional_index;
{
char buffer[64] = "my prefix ";
append_formated_multidimensional_index(buffer, 1);
EXPECT_STREQ(buffer, "my prefix [1]");
}
{
char buffer[64] = "I was here";
append_formated_multidimensional_index(buffer, 1, 2, 3);
EXPECT_STREQ(buffer, "I was here[1,2,3]");
}
}

template <class View, class ExecutionSpace>
struct TestViewOutOfBoundAccess {
View v;
Expand Down Expand Up @@ -146,3 +162,5 @@ TEST(TEST_CATEGORY_DEATH, view_out_of_bounds_access) {

test_view_out_of_bounds_access<ExecutionSpace>();
}

} // namespace

0 comments on commit 7fa2b81

Please sign in to comment.