Initial Course
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#include "mdspan.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Mdspan, MatrixElement) {
|
||||
auto storage = cpp23::make_row_major_matrix(2, 3, 1);
|
||||
const auto matrix = std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>>(
|
||||
storage.data(), 2, 3);
|
||||
EXPECT_EQ(cpp23::matrix_element(matrix, 1, 2), 1);
|
||||
}
|
||||
|
||||
TEST(Mdspan, RowSums) {
|
||||
std::vector<int> storage = {1, 2, 3, 4, 5, 6};
|
||||
const auto matrix = std::mdspan<const int, std::extents<int, std::dynamic_extent, std::dynamic_extent>>(
|
||||
storage.data(), 2, 3);
|
||||
EXPECT_EQ(cpp23::row_sums(matrix), (std::vector<int>{6, 15}));
|
||||
}
|
||||
Reference in New Issue
Block a user