Skip to content

Commit 6da274c

Browse files
committed
Add verbose options to assert test functions
1 parent aa33914 commit 6da274c

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

test/basic_interface.hpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,22 @@ auto generate_hermitian_data(std::size_t n) {
6060

6161
// Some testing output + the actual GoogleTest assert statement
6262
template <typename input_t, typename fourier_t, typename output_t>
63-
void assert_results(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a) {
64-
// std::cout << "real input: " << a << std::endl;
65-
// std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
66-
// std::cout << "real output: " << should_be_a << std::endl;
63+
void assert_results(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a, bool verbose = false) {
64+
if (verbose) {
65+
std::cout << "real input: " << a << std::endl;
66+
std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
67+
std::cout << "real output: " << should_be_a << std::endl;
68+
}
6769
ASSERT_TRUE(xt::allclose(a, should_be_a, 1e-03));
6870
}
6971

7072
template <typename input_t, typename fourier_t, typename output_t>
71-
void assert_results_complex(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a) {
72-
// std::cout << "complex input: " << a << std::endl;
73-
// std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
74-
// std::cout << "complex output: " << should_be_a << std::endl;
73+
void assert_results_complex(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a, bool verbose = false) {
74+
if (verbose) {
75+
std::cout << "complex input: " << a << std::endl;
76+
std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
77+
std::cout << "complex output: " << should_be_a << std::endl;
78+
}
7579
ASSERT_TRUE(xt::allclose(xt::real(a), xt::real(should_be_a), 1e-03)
7680
&& xt::allclose(xt::imag(a), xt::imag(should_be_a), 1e-03));
7781
}

0 commit comments

Comments
 (0)