Skip to content

Commit b6f5b57

Browse files
committed
Perform tolerance-based checks in expressions tests
1 parent 561bf8f commit b6f5b57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/expression/expressions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void bin_ops (const ViewT& x, const ViewT& y, const ViewT& z)
2828
auto y_val = yh.data()[i];
2929
auto z_val = zh.data()[i];
3030
auto tgt = x_val*y_val-1/y_val+2*x_val;
31-
REQUIRE (z_val==tgt);
31+
REQUIRE (z_val==Approx(tgt).epsilon(1e-10));
3232
}
3333
}
3434

@@ -48,7 +48,7 @@ void math_fcns (const ViewT& x, const ViewT& y, const ViewT& z)
4848
auto z_val = zh.data()[i];
4949
auto tgt = 2*std::exp(-x_val)*std::sin(x_val)*std::log(y_val)
5050
- std::sqrt(x_val) + std::pow(y_val,2) + std::pow(3,x_val);
51-
REQUIRE (z_val==tgt);
51+
REQUIRE (z_val==Approx(tgt).epsilon(1e-10));
5252
}
5353
}
5454

0 commit comments

Comments
 (0)