feat(cpp-object-oriented-modular-refactoring): step 10 - dense-blas-adapter

This commit is contained in:
KOKO\Mimi
2026-08-16 07:49:57 +09:00
parent 6b0ff31db0
commit 89fc13c873
7 changed files with 146 additions and 49 deletions
@@ -0,0 +1,39 @@
#include "math/dense_blas_internal.h"
#include <gtest/gtest.h>
#include <array>
#include <cstddef>
#include <limits>
namespace fesa::dense_blas_internal {
namespace {
TEST(DenseBlasInternal, CDup003ConvertsZeroNormalAndOverflowLengths) {
const auto zero = ToMklSize(0U);
ASSERT_TRUE(zero.HasValue());
EXPECT_EQ(zero.Value(), 0);
const auto normal = ToMklSize(3U);
ASSERT_TRUE(normal.HasValue());
EXPECT_EQ(normal.Value(), 3);
const std::size_t overflow =
static_cast<std::size_t>((std::numeric_limits<MKL_INT>::max)()) + 1U;
const auto rejected = ToMklSize(overflow);
EXPECT_FALSE(rejected.HasValue());
EXPECT_FALSE(rejected.GetStatus().IsOk());
}
TEST(DenseBlasInternal, CDup003CopiesZeroAndNonzeroContiguousValues) {
EXPECT_NO_THROW(CopyValues(nullptr, 0U, nullptr));
const std::array<double, 3U> source{1.25, -2.5, 4.0};
std::array<double, 3U> destination{};
CopyValues(source.data(), source.size(), destination.data());
EXPECT_EQ(destination, source);
}
} // namespace
} // namespace fesa::dense_blas_internal