Skip to content

Commit 0fa3e5c

Browse files
committed
Make tests less verbose
1 parent 98588c3 commit 0fa3e5c

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

test/basic_interface.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ auto generate_hermitian_data(std::size_t n) {
6969
// Some testing output + the actual GoogleTest assert statement
7070
template <typename input_t, typename fourier_t, typename output_t>
7171
void assert_results(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a) {
72-
std::cout << "real input: " << a << std::endl;
73-
std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
74-
std::cout << "real output: " << should_be_a << std::endl;
72+
// std::cout << "real input: " << a << std::endl;
73+
// std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
74+
// std::cout << "real output: " << should_be_a << std::endl;
7575
ASSERT_TRUE(xt::allclose(a, should_be_a, 1e-03));
7676
}
7777

7878
template <typename input_t, typename fourier_t, typename output_t>
7979
void assert_results_complex(const input_t &a, const fourier_t &a_fourier, const output_t &should_be_a) {
80-
std::cout << "complex input: " << a << std::endl;
81-
std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
82-
std::cout << "complex output: " << should_be_a << std::endl;
80+
// std::cout << "complex input: " << a << std::endl;
81+
// std::cout << "fourier transform of input after ifft (usually different from before): " << a_fourier << std::endl;
82+
// std::cout << "complex output: " << should_be_a << std::endl;
8383
ASSERT_TRUE(xt::allclose(xt::real(a), xt::real(should_be_a), 1e-03)
8484
&& xt::allclose(xt::imag(a), xt::imag(should_be_a), 1e-03));
8585
}
@@ -99,39 +99,39 @@ std::size_t data_size = 4;
9999
TYPED_TEST(TransformAndInvert, FFT_1D_xarray) {
100100
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_complex_data<TypeParam, 1>(data_size);
101101
auto a_fourier = xt::fftw::fft(a);
102-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
102+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
103103
auto should_be_a = xt::fftw::ifft(a_fourier);
104104
assert_results_complex(a, a_fourier, should_be_a);
105105
}
106106

107107
TYPED_TEST(TransformAndInvert, FFT_2D_xarray) {
108108
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_complex_data<TypeParam, 2>(data_size);
109109
auto a_fourier = xt::fftw::fft2(a);
110-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
110+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
111111
auto should_be_a = xt::fftw::ifft2(a_fourier);
112112
assert_results_complex(a, a_fourier, should_be_a);
113113
}
114114

115115
TYPED_TEST(TransformAndInvert, FFT_3D_xarray) {
116116
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_complex_data<TypeParam, 3>(data_size);
117117
auto a_fourier = xt::fftw::fft3(a);
118-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
118+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
119119
auto should_be_a = xt::fftw::ifft3(a_fourier);
120120
assert_results_complex(a, a_fourier, should_be_a);
121121
}
122122

123123
TYPED_TEST(TransformAndInvert, FFT_nD_n_equals_4_xarray) {
124124
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_complex_data<TypeParam, 4>(data_size);
125125
auto a_fourier = xt::fftw::fftn<4>(a);
126-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
126+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
127127
auto should_be_a = xt::fftw::ifftn<4>(a_fourier);
128128
assert_results_complex(a, a_fourier, should_be_a);
129129
}
130130

131131
TYPED_TEST(TransformAndInvert, FFT_nD_n_equals_1_xarray) {
132132
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_complex_data<TypeParam, 1>(data_size);
133133
auto a_fourier = xt::fftw::fftn<1>(a);
134-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
134+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
135135
auto should_be_a = xt::fftw::ifftn<1>(a_fourier);
136136
assert_results_complex(a, a_fourier, should_be_a);
137137
}
@@ -145,31 +145,31 @@ TYPED_TEST(TransformAndInvert, FFT_nD_n_equals_1_xarray) {
145145
TYPED_TEST(TransformAndInvert, FFT_1D_xtensor) {
146146
xt::xtensor<std::complex<TypeParam>, 1> a = generate_complex_data<TypeParam, 1>(data_size);
147147
auto a_fourier = xt::fftw::fft(a);
148-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
148+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
149149
auto should_be_a = xt::fftw::ifft(a_fourier);
150150
assert_results_complex(a, a_fourier, should_be_a);
151151
}
152152
153153
TYPED_TEST(TransformAndInvert, FFT_2D_xtensor) {
154154
xt::xtensor<std::complex<TypeParam>, 2> a = generate_complex_data<TypeParam, 2>(data_size);
155155
auto a_fourier = xt::fftw::fft2(a);
156-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
156+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
157157
auto should_be_a = xt::fftw::ifft2(a_fourier);
158158
assert_results_complex(a, a_fourier, should_be_a);
159159
}
160160
161161
TYPED_TEST(TransformAndInvert, FFT_3D_xtensor) {
162162
xt::xtensor<std::complex<TypeParam>, 3> a = generate_complex_data<TypeParam, 3>(data_size);
163163
auto a_fourier = xt::fftw::fft3(a);
164-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
164+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
165165
auto should_be_a = xt::fftw::ifft3(a_fourier);
166166
assert_results_complex(a, a_fourier, should_be_a);
167167
}
168168
169169
TYPED_TEST(TransformAndInvert, FFT_4D_xtensor) {
170170
xt::xtensor<std::complex<TypeParam>, 4> a = generate_complex_data<TypeParam, 4>(data_size);
171171
auto a_fourier = xt::fftw::fftn(a);
172-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
172+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
173173
auto should_be_a = xt::fftw::ifftn(a_fourier);
174174
assert_results_complex(a, a_fourier, should_be_a);
175175
}
@@ -186,15 +186,15 @@ TYPED_TEST(TransformAndInvert, FFT_4D_xtensor) {
186186
TYPED_TEST(TransformAndInvert, realFFT_1D_xarray) {
187187
xt::xarray<TypeParam, xt::layout_type::row_major> a = generate_data<TypeParam, 1>(data_size);
188188
auto a_fourier = xt::fftw::rfft(a);
189-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
189+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
190190
auto should_be_a = xt::fftw::irfft(a_fourier);
191191
assert_results(a, a_fourier, should_be_a);
192192
}
193193

194194
TYPED_TEST(TransformAndInvert, realFFT_2D_xarray) {
195195
xt::xarray<TypeParam, xt::layout_type::row_major> a = generate_data<TypeParam, 2>(data_size);
196196
auto a_fourier = xt::fftw::rfft2(a);
197-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
197+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
198198
auto should_be_a = xt::fftw::irfft2(a_fourier);
199199
assert_results(a, a_fourier, should_be_a);
200200
}
@@ -203,7 +203,7 @@ TYPED_TEST(TransformAndInvert, realFFT_2D_xarray) {
203203
TYPED_TEST(TransformAndInvert, realFFT_3D_xarray) {
204204
xt::xarray<TypeParam> a = generate_data<TypeParam, 3>(data_size);
205205
auto a_fourier = xt::fftw::rfft3(a);
206-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
206+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
207207
auto should_be_a = xt::fftw::irfft3(a_fourier);
208208
assert_results(a, a_fourier, should_be_a);
209209
}
@@ -212,15 +212,15 @@ TYPED_TEST(TransformAndInvert, realFFT_3D_xarray) {
212212
TYPED_TEST(TransformAndInvert, realFFT_nD_n_equals_4_xarray) {
213213
xt::xarray<TypeParam> a = generate_data<TypeParam, 4>(data_size);
214214
auto a_fourier = xt::fftw::rfftn<4>(a);
215-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
215+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
216216
auto should_be_a = xt::fftw::irfftn<4>(a_fourier);
217217
assert_results(a, a_fourier, should_be_a);
218218
}
219219

220220
TYPED_TEST(TransformAndInvert, realFFT_nD_n_equals_1_xarray) {
221221
xt::xarray<TypeParam> a = generate_data<TypeParam, 1>(data_size);
222222
auto a_fourier = xt::fftw::rfftn<1>(a);
223-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
223+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
224224
auto should_be_a = xt::fftw::irfftn<1>(a_fourier);
225225
assert_results(a, a_fourier, should_be_a);
226226
}
@@ -233,31 +233,31 @@ TYPED_TEST(TransformAndInvert, realFFT_nD_n_equals_1_xarray) {
233233
TYPED_TEST(TransformAndInvert, realFFT_1D_xtensor) {
234234
xt::xtensor<TypeParam, 1> a = generate_data<TypeParam, 1>(data_size);
235235
auto a_fourier = xt::fftw::rfft(a);
236-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
236+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
237237
auto should_be_a = xt::fftw::irfft(a_fourier);
238238
assert_results(a, a_fourier, should_be_a);
239239
}
240240
241241
TYPED_TEST(TransformAndInvert, realFFT_2D_xtensor) {
242242
xt::xtensor<TypeParam, 2> a = generate_data<TypeParam, 2>(data_size);
243243
auto a_fourier = xt::fftw::rfft2(a);
244-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
244+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
245245
auto should_be_a = xt::fftw::irfft2(a_fourier);
246246
assert_results(a, a_fourier, should_be_a);
247247
}
248248
249249
TYPED_TEST(TransformAndInvert, realFFT_3D_xtensor) {
250250
xt::xtensor<TypeParam, 3> a = generate_data<TypeParam, 3>(data_size);
251251
auto a_fourier = xt::fftw::rfft3(a);
252-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
252+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
253253
auto should_be_a = xt::fftw::irfft3(a_fourier);
254254
assert_results(a, a_fourier, should_be_a);
255255
}
256256
257257
TYPED_TEST(TransformAndInvert, realFFT_4D_xtensor) {
258258
xt::xtensor<TypeParam, 4> a = generate_data<TypeParam, 4>(data_size);
259259
auto a_fourier = xt::fftw::rfftn(a);
260-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
260+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
261261
auto should_be_a = xt::fftw::irfftn(a_fourier);
262262
assert_results(a, a_fourier, should_be_a);
263263
}
@@ -274,39 +274,39 @@ TYPED_TEST(TransformAndInvert, realFFT_4D_xtensor) {
274274
TYPED_TEST(TransformAndInvert, hermFFT_1D_xarray) {
275275
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_hermitian_data<TypeParam, 1, xt::fftw::hfft, xt::fftw::ihfft>(data_size);
276276
auto a_fourier = xt::fftw::hfft(a);
277-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
277+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
278278
auto should_be_a = xt::fftw::ihfft(a_fourier);
279279
assert_results_complex(a, a_fourier, should_be_a);
280280
}
281281

282282
TYPED_TEST(TransformAndInvert, hermFFT_2D_xarray) {
283283
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_hermitian_data<TypeParam, 2, xt::fftw::hfft2, xt::fftw::ihfft2>(data_size);
284284
auto a_fourier = xt::fftw::hfft2(a);
285-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
285+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
286286
auto should_be_a = xt::fftw::ihfft2(a_fourier);
287287
assert_results_complex(a, a_fourier, should_be_a);
288288
}
289289

290290
TYPED_TEST(TransformAndInvert, hermFFT_3D_xarray) {
291291
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_hermitian_data<TypeParam, 3, xt::fftw::hfft3, xt::fftw::ihfft3>(data_size);
292292
auto a_fourier = xt::fftw::hfft3(a);
293-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
293+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
294294
auto should_be_a = xt::fftw::ihfft3(a_fourier);
295295
assert_results_complex(a, a_fourier, should_be_a);
296296
}
297297

298298
TYPED_TEST(TransformAndInvert, hermFFT_nD_n_equals_4_xarray) {
299299
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_hermitian_data<TypeParam, 4, xt::fftw::hfftn<4>, xt::fftw::ihfftn<4>>(data_size);
300300
auto a_fourier = xt::fftw::hfftn<4>(a);
301-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
301+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
302302
auto should_be_a = xt::fftw::ihfftn<4>(a_fourier);
303303
assert_results_complex(a, a_fourier, should_be_a);
304304
}
305305

306306
TYPED_TEST(TransformAndInvert, hermFFT_nD_n_equals_1_xarray) {
307307
xt::xarray<std::complex<TypeParam>, xt::layout_type::row_major> a = generate_hermitian_data<TypeParam, 1, xt::fftw::hfft, xt::fftw::ihfft>(data_size);
308308
auto a_fourier = xt::fftw::hfftn<1>(a);
309-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
309+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
310310
auto should_be_a = xt::fftw::ihfftn<1>(a_fourier);
311311
assert_results_complex(a, a_fourier, should_be_a);
312312
}
@@ -319,31 +319,31 @@ TYPED_TEST(TransformAndInvert, hermFFT_nD_n_equals_1_xarray) {
319319
TYPED_TEST(TransformAndInvert, hermFFT_1D_xtensor) {
320320
xt::xtensor<std::complex<TypeParam>, 1> a = generate_hermitian_data<TypeParam, 1>(data_size);
321321
auto a_fourier = xt::fftw::hfft(a);
322-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
322+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
323323
auto should_be_a = xt::fftw::ihfft(a_fourier);
324324
assert_results_complex(a, a_fourier, should_be_a);
325325
}
326326
327327
TYPED_TEST(TransformAndInvert, hermFFT_2D_xtensor) {
328328
xt::xtensor<std::complex<TypeParam>, 2> a = generate_hermitian_data<TypeParam, 2>(data_size);
329329
auto a_fourier = xt::fftw::hfft2(a);
330-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
330+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
331331
auto should_be_a = xt::fftw::ihfft2(a_fourier);
332332
assert_results_complex(a, a_fourier, should_be_a);
333333
}
334334
335335
TYPED_TEST(TransformAndInvert, hermFFT_3D_xtensor) {
336336
xt::xtensor<std::complex<TypeParam>, 3> a = generate_hermitian_data<TypeParam, 3>(data_size);
337337
auto a_fourier = xt::fftw::hfft3(a);
338-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
338+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
339339
auto should_be_a = xt::fftw::ihfft3(a_fourier);
340340
assert_results_complex(a, a_fourier, should_be_a);
341341
}
342342
343343
TYPED_TEST(TransformAndInvert, hermFFT_4D_xtensor) {
344344
xt::xtensor<std::complex<TypeParam>, 4> a = generate_hermitian_data<TypeParam, 4>(data_size);
345345
auto a_fourier = xt::fftw::hfftn(a);
346-
std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
346+
// std::cout << "fourier transform of input before ifft (which is destructive!): " << a_fourier << std::endl;
347347
auto should_be_a = xt::fftw::ihfftn(a_fourier);
348348
assert_results_complex(a, a_fourier, should_be_a);
349349
}

0 commit comments

Comments
 (0)