Skip to content

Commit

Permalink
Formatting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuichi Asahi committed Jan 23, 2024
1 parent 8c7555b commit 189031a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 9 additions & 9 deletions common/unit_test/Test_Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ TEST(ExtractExtents, 1Dto8D) {
using View7Dtype = Kokkos::View<double*******, execution_space>;
using View8Dtype = Kokkos::View<double********, execution_space>;

std::size_t n1 = 1, n2 = 1, n3 = 2, n4 = 3, n5= 5, n6 = 8, n7 = 13, n8 = 21;
std::size_t n1 = 1, n2 = 1, n3 = 2, n4 = 3, n5 = 5, n6 = 8, n7 = 13, n8 = 21;

std::array<std::size_t, 1> ref_extents1D = {n1};
std::array<std::size_t, 2> ref_extents2D = {n1, n2};
Expand All @@ -284,12 +284,12 @@ TEST(ExtractExtents, 1Dto8D) {
View7Dtype view7D("view7D", n1, n2, n3, n4, n5, n6, n7);
View8Dtype view8D("view8D", n1, n2, n3, n4, n5, n6, n7, n8);

EXPECT_EQ( KokkosFFT::Impl::extract_extents(view1D), ref_extents1D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view2D), ref_extents2D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view3D), ref_extents3D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view4D), ref_extents4D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view5D), ref_extents5D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view6D), ref_extents6D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view7D), ref_extents7D );
EXPECT_EQ( KokkosFFT::Impl::extract_extents(view8D), ref_extents8D );
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view1D), ref_extents1D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view2D), ref_extents2D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view3D), ref_extents3D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view4D), ref_extents4D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view5D), ref_extents5D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view6D), ref_extents6D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view7D), ref_extents7D);
EXPECT_EQ(KokkosFFT::Impl::extract_extents(view8D), ref_extents8D);
}
19 changes: 10 additions & 9 deletions fft/unit_test/Test_Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,52 +268,53 @@ void test_fft1_identity_reuse_plan(T atol = 1.0e-12) {
// Check if errors are correctly raised aginst wrong extents
const int maxlen_wrong = 32 * 2;
ComplexView1DType a_wrong("a", maxlen_wrong), _a_wrong("_a", maxlen_wrong);
ComplexView1DType out_wrong("out", maxlen_wrong), outr_wrong("outr", maxlen_wrong / 2 + 1);
ComplexView1DType out_wrong("out", maxlen_wrong),
outr_wrong("outr", maxlen_wrong / 2 + 1);
RealView1DType ar_wrong("ar", maxlen_wrong), _ar_wrong("_ar", maxlen_wrong);

// fft
// With incorrect input shape
EXPECT_THROW(KokkosFFT::fft(execution_space(), a_wrong, out, fft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// With incorrect output shape
EXPECT_THROW(KokkosFFT::fft(execution_space(), a, out_wrong, fft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// ifft
// With incorrect input shape
EXPECT_THROW(KokkosFFT::ifft(execution_space(), out_wrong, _a, ifft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// With incorrect output shape
EXPECT_THROW(KokkosFFT::ifft(execution_space(), out, _a_wrong, ifft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// rfft
// With incorrect input shape
EXPECT_THROW(KokkosFFT::rfft(execution_space(), ar_wrong, outr, rfft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// With incorrect output shape
EXPECT_THROW(KokkosFFT::rfft(execution_space(), ar, out_wrong, rfft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// irfft
// With incorrect input shape
EXPECT_THROW(KokkosFFT::irfft(execution_space(), outr_wrong, _ar, irfft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);

// With incorrect output shape
EXPECT_THROW(KokkosFFT::irfft(execution_space(), outr, _ar_wrong, irfft_plan,
KokkosFFT::Normalization::BACKWARD, axis),
std::runtime_error);
std::runtime_error);
}

template <typename T, typename LayoutType>
Expand Down

0 comments on commit 189031a

Please sign in to comment.