1 | /*-----------------------------------------------------------------------------+ |
2 | Copyright (c) 2008-2009: Joachim Faulhaber |
3 | +------------------------------------------------------------------------------+ |
4 | Distributed under the Boost Software License, Version 1.0. |
5 | (See accompanying file LICENCE.txt or copy at |
6 | http://www.boost.org/LICENSE_1_0.txt) |
7 | +-----------------------------------------------------------------------------*/ |
8 | #ifndef BOOST_ICL_TEST_ICL_DYNAMIC_INTERVAL_HPP_JOFA_100930 |
9 | #define BOOST_ICL_TEST_ICL_DYNAMIC_INTERVAL_HPP_JOFA_100930 |
10 | |
11 | template <class IntervalT> |
12 | void dynamic_interval_ctor_4_ordered_types() |
13 | { |
14 | typedef typename domain_type_of<interval_traits<IntervalT> >::type T; |
15 | |
16 | BOOST_CHECK_EQUAL(IntervalT().lower(), icl::identity_element<T>::value()); |
17 | BOOST_CHECK_EQUAL(IntervalT().upper(), icl::identity_element<T>::value()); |
18 | BOOST_CHECK_EQUAL(icl::lower(IntervalT()), icl::identity_element<T>::value()); |
19 | BOOST_CHECK_EQUAL(icl::upper(IntervalT()), icl::identity_element<T>::value()); |
20 | |
21 | IntervalT empty_itv = IntervalT(icl::identity_element<T>::value(), icl::identity_element<T>::value()); |
22 | BOOST_CHECK_EQUAL(IntervalT(), empty_itv); |
23 | BOOST_CHECK_EQUAL(IntervalT(), IntervalT(icl::identity_element<T>::value(), icl::identity_element<T>::value())); |
24 | BOOST_CHECK_EQUAL(IntervalT(), IntervalT(icl::identity_element<T>::value(), icl::identity_element<T>::value(), interval_bounds::right_open())); |
25 | } |
26 | |
27 | template <class T> |
28 | void dynamic_interval_bounds_4_bicremental_types() |
29 | { |
30 | typedef typename icl::interval<T>::type IntervalT; |
31 | |
32 | // BOOST_CHECK_EQUAL( T(), icl::pred(icl::succ(T()))); |
33 | BOOST_CHECK_EQUAL( icl::identity_element<T>::value(), icl::pred(icl::succ(icl::identity_element<T>::value())) ); |
34 | BOOST_CHECK_EQUAL( icl::unit_element<T>::value(), icl::succ(icl::identity_element<T>::value()) ); |
35 | BOOST_CHECK_EQUAL( length(IntervalT()), icl::identity_element<typename difference_type_of<T>::type>::value() ); |
36 | |
37 | //LAW: I x: borders(x)==closed => contains(x, lower(x)) && contains(x, upper(x)) |
38 | check_border_containedness(I_I(0,0)); |
39 | check_border_containedness(I_I(2,5)); |
40 | |
41 | check_border_containedness(I_D(0,1)); |
42 | check_border_containedness(I_D(2,5)); |
43 | |
44 | check_border_containedness(C_I(0,1)); |
45 | check_border_containedness(C_I(2,5)); |
46 | |
47 | check_border_containedness(C_D(0,2)); |
48 | check_border_containedness(C_D(2,5)); |
49 | |
50 | } |
51 | |
52 | template <class T> |
53 | void discrete_dynamic_interval_bounds_4_bicremental_types() |
54 | { |
55 | //CL typedef typename icl::interval<T>::type IntervalT; |
56 | |
57 | BOOST_CHECK( icl::bounds(I_I(2,4)) == interval_bounds::closed() ); |
58 | BOOST_CHECK( icl::bounds(I_D(2,5)) == interval_bounds::right_open() ); |
59 | BOOST_CHECK( icl::bounds(C_I(1,4)) == interval_bounds::left_open() ); |
60 | BOOST_CHECK( icl::bounds(C_D(1,5)) == interval_bounds::open() ); |
61 | |
62 | } |
63 | |
64 | |
65 | |
66 | #endif // BOOST_ICL_TEST_ICL_DYNAMIC_INTERVAL_HPP_JOFA_100930 |
67 | |