40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
#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
|