// Copyright (c) 2013 Ruslan Baratov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include "../include/safe_integer.hpp" #include template void test_equal(T test_val) { namespace num = boost::numeric; num::safe x = test_val; num::safe y = test_val; assert(x == y); assert(x >= y); assert(x <= y); assert(!(x < y)); assert(!(x > y)); } template void test_non_equal(T test_val) { namespace num = boost::numeric; num::safe x(test_val); num::safe y(test_val + 1); assert(x != y); assert(!(x >= y)); assert(x <= y); assert(x < y); assert(!(x > y)); } int main() { test_equal(0); test_equal(3); test_equal(14); test_equal(3); test_equal(45); test_non_equal(342); test_non_equal(33); test_non_equal(-988); }