Skip to content

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten committed Oct 14, 2021
1 parent 66d5ebf commit b22f8ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ set(XTENSOR_BLAS_TESTS
test_dot.cpp
test_dot_extended.cpp
test_qr.cpp
test_complex_float_norm.cpp
test_float_norm.cpp
)

add_executable(test_xtensor_blas ${XTENSOR_BLAS_TESTS} ${XTENSOR_BLAS_HEADERS} ${XTENSOR_HEADERS})
Expand Down
17 changes: 11 additions & 6 deletions test/test_complex_float_norm.cpp → test/test_float_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
namespace xt
{

TEST(xblas, norm_complex_float) {
xt::xarray<std::complex<float>> a = {std::complex<float>(1.0f, 2.0f), std::complex<float>(3.0f, 4.0f)};
auto res = linalg::norm(a);
TEST(xblas, norm_complex_float) {
xt::xarray<std::complex<float>> a = {std::complex<float>(1.0f, 2.0f), std::complex<float>(3.0f, 4.0f)};
auto res = linalg::norm(a);

EXPECT_NEAR(res.real(), 5.4772f, 1e-3f);
EXPECT_NEAR(res.imag(), 0.0f, 1e-3f);
}
EXPECT_NEAR(res.real(), 5.4772f, 1e-3f);
EXPECT_NEAR(res.imag(), 0.0f, 1e-3f);
}

TEST(xblas, norm_float_arange)
{
xt::linalg::norm(xt::arange<float>(15), 1);
}

}

0 comments on commit b22f8ff

Please sign in to comment.