Skip to content
Snippets Groups Projects
Unverified Commit 56011dfc authored by René Fritze's avatar René Fritze
Browse files

[test.validation] using integer limits provoked test failure

parent 0b0d587a
No related branches found
No related tags found
No related merge requests found
......@@ -42,19 +42,16 @@ struct ValidationTest : public testing::Test
void all()
{
using namespace boost::assign;
const int samples = 100;
std::cout << "\tTesting Validators for type " << Typename<T>::value() << "\n\t\t" << samples
<< " random numbers ..." << std::endl;
{
typedef VectorAbstraction<T>::S S;
const auto scalar_eps = Epsilon<S>::value;
const T lower = init_bound<T>(std::numeric_limits<S>::min() + scalar_eps);
const T upper = init_bound<T>(std::numeric_limits<S>::max() - scalar_eps);
RNGType rng(lower, upper);
for (int i = samples; i > 0; --i) {
const T arg = rng();
const T lower = init_bound<T>(std::numeric_limits<S>::min() / 6 + scalar_eps);
const T upper = init_bound<T>(std::numeric_limits<S>::max() / 6 - scalar_eps);
for (auto&& arg : std::array<T, 3>{{lower, T(0), upper}}) {
test(lower, upper, arg);
}
RNGType rng(lower, upper);
boost::array<T, 10> ar = list_of<T>().repeat_fun(9, rng);
ValidateInList<T, boost::array<T, 10>> validator(ar);
for (T t : ar) {
......
......@@ -108,7 +108,7 @@ public:
}
};
//! validate arg iff less than value, obviously
//! validate arg iff lhs < rhs
template <class T>
class ValidateLess : public ValidatorInterface<T, ValidateLess<T>>
{
......@@ -131,7 +131,7 @@ private:
const T lhs_;
};
//! validate arg iff greater than value, obviously
//! validate arg iff lhs > rhs, obviously
template <class T>
class ValidateGreater : public ValidatorInterface<T, ValidateGreater<T>>
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment