2011-05-23 17:18:52 +10:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
#include "../debug.hpp"
|
|
|
|
#include "../range.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int, char **) {
|
2011-07-29 17:56:26 +10:00
|
|
|
check_hard ( range<double>::UNIT.contains ( 0.0));
|
|
|
|
check_hard ( range<double>::UNIT.contains ( 0.5));
|
|
|
|
check_hard ( range<double>::UNIT.contains ( 1.0));
|
|
|
|
check_hard (!range<double>::UNIT.contains (-0.00001));
|
|
|
|
check_hard (!range<double>::UNIT.contains ( 1.00001));
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-07-29 17:56:26 +10:00
|
|
|
check_hard ( range<uint16_t>::UNIT.contains (0));
|
|
|
|
check_hard ( range<uint16_t>::UNIT.contains (1));
|
|
|
|
check_hard (!range<uint16_t>::UNIT.contains (2));
|
|
|
|
check_hard (!range<uint16_t>::UNIT.contains (numeric_limits <uint16_t>::max ()));
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-07-29 17:56:26 +10:00
|
|
|
check_hard ( range<double>::UNLIMITED.contains (0.0));
|
|
|
|
check_hard ( range<double>::UNLIMITED.contains (+numeric_limits<double>::infinity ()));
|
|
|
|
check_hard ( range<double>::UNLIMITED.contains (-numeric_limits<double>::infinity ()));
|
|
|
|
check_hard (!range<double>::UNLIMITED.contains ( numeric_limits<double>::quiet_NaN ()));
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-07-29 17:56:26 +10:00
|
|
|
check_hard ( range<uint16_t>::UNLIMITED.contains (numeric_limits<uint16_t>::min()));
|
|
|
|
check_hard ( range<uint16_t>::UNLIMITED.contains (numeric_limits<uint16_t>::max()));
|
2011-05-23 17:18:52 +10:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|