Skip to content

Commit 528f186

Browse files
[test] Improve testing logging and accuracy
1 parent 6e9e932 commit 528f186

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

test/test_complex_trigonometric.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,14 @@ struct complex_trigonometric_test
148148
std::transform(atan_input.cbegin(), atan_input.cend(), expected.begin(),
149149
[](const value_type& v)
150150
{ using std::atan; return atan(v); });
151-
batch_type in, out;
151+
batch_type in, out, ref;
152152
for (size_t i = 0; i < nb_input; i += size)
153153
{
154154
detail::load_batch(in, atan_input, i);
155155
out = atan(in);
156-
detail::store_batch(out, res, i);
156+
detail::load_batch(ref, expected, i);
157+
CHECK_BATCH_EQ(ref, out);
157158
}
158-
size_t diff = detail::get_nb_diff(res, expected);
159-
CHECK_EQ(diff, 0);
160159
}
161160

162161
private:

test/test_xsimd_api.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,13 @@ struct xsimd_api_float_types_functions
740740
{
741741
value_type val0(2);
742742
value_type val1(2);
743+
value_type nval1(-3);
743744
int ival1 = 4;
745+
int nival1 = -5;
744746
CHECK_EQ(extract(xsimd::pow(T(val0), T(val1))), std::pow(val0, val1));
745747
CHECK_EQ(extract(xsimd::pow(T(val0), ival1)), std::pow(val0, ival1));
748+
CHECK_EQ(extract(xsimd::pow(T(val0), T(nval1))), doctest::Approx(std::pow(val0, nval1)));
749+
CHECK_EQ(extract(xsimd::pow(T(val0), nival1)), doctest::Approx(std::pow(val0, nival1)));
746750
}
747751
void test_reciprocal()
748752
{
@@ -784,7 +788,7 @@ struct xsimd_api_float_types_functions
784788
void test_sqrt()
785789
{
786790
value_type val(1);
787-
CHECK_EQ(extract(xsimd::sqrt(T(val))), std::sqrt(val));
791+
CHECK_EQ(extract(xsimd::sqrt(T(val))), doctest::Approx(std::sqrt(val)));
788792
}
789793
void test_tan()
790794
{
@@ -1183,7 +1187,7 @@ struct xsimd_api_all_signed_types_functions
11831187
void test_abs()
11841188
{
11851189
value_type val(-1);
1186-
CHECK_EQ(extract(xsimd::abs(T(val))), std::abs(val));
1190+
CHECK_EQ(extract(xsimd::abs(T(val))), doctest::Approx(std::abs(val)));
11871191
}
11881192

11891193
void test_fnms()

0 commit comments

Comments
 (0)