mirror of
https://github.com/boostorg/icl.git
synced 2026-01-19 04:12:13 +00:00
added code for span and hull from docs.
This commit is contained in:
@@ -166,8 +166,11 @@ BOOST_AUTO_TEST_CASE(test_span_and_hull)
|
||||
cl_I_int span_1_2 = span< cl_I_int >(1,2);
|
||||
cl_I_int span_2_1 = span< cl_I_int >(2,1);
|
||||
BOOST_CHECK_EQUAL(span_1_2, span_2_1);
|
||||
BOOST_CHECK_EQUAL(hull< cl_I_int >(1,2), hull< cl_I_int >(2,1));
|
||||
|
||||
BOOST_CHECK_EQUAL(hull< cl_I_int >(1,2), hull< cl_I_int >(1,2));
|
||||
BOOST_CHECK_EQUAL( hull< right_open_interval<int> >(-1,2)
|
||||
, hull< right_open_interval<int> >(-1,2) );
|
||||
BOOST_CHECK_EQUAL( span< right_open_interval<int> >(2,1)
|
||||
, construct< right_open_interval<int> >(1,2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( hull< right_open_interval<int> >(2,1)
|
||||
, construct< right_open_interval<int> >(1,3) );
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ void distant_intervals_4_discrete_types()
|
||||
{
|
||||
typedef right_open_interval<T,Compare> L__D; // L__D for [..)
|
||||
typedef left_open_interval<T,Compare> C__I; // C__I for (..]
|
||||
typedef closed_interval<T,Compare> L__I; // L__I for [..]
|
||||
typedef open_interval<T,Compare> C__D; // C__D for (..)
|
||||
typedef closed_interval<T,Compare> L__I; // L__I for [..]
|
||||
typedef open_interval<T,Compare> C__D; // C__D for (..)
|
||||
typedef typename icl::interval<T,Compare>::type IntervalT;
|
||||
|
||||
BOOST_CHECK( is_interval<L__D>::value );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*-----------------------------------------------------------------------------+
|
||||
/*-----------------------------------------------------------------------------+
|
||||
Copyright (c) 2008-2009: Joachim Faulhaber
|
||||
+------------------------------------------------------------------------------+
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
@@ -8,7 +8,7 @@ Copyright (c) 2008-2009: Joachim Faulhaber
|
||||
#ifndef BOOST_ICL_TEST_ICL_DYNAMIC_INTERVAL_HPP_JOFA_100930
|
||||
#define BOOST_ICL_TEST_ICL_DYNAMIC_INTERVAL_HPP_JOFA_100930
|
||||
|
||||
template <class IntervalT>
|
||||
template <class IntervalT>
|
||||
void dynamic_interval_ctor_4_ordered_types()
|
||||
{
|
||||
typedef typename domain_type_of<interval_traits<IntervalT> >::type T;
|
||||
@@ -24,7 +24,7 @@ void dynamic_interval_ctor_4_ordered_types()
|
||||
BOOST_CHECK_EQUAL(IntervalT(), IntervalT(icl::identity_element<T>::value(), icl::identity_element<T>::value(), interval_bounds::right_open()));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <class T>
|
||||
void dynamic_interval_bounds_4_bicremental_types()
|
||||
{
|
||||
typedef typename icl::interval<T>::type IntervalT;
|
||||
@@ -44,12 +44,12 @@ void dynamic_interval_bounds_4_bicremental_types()
|
||||
check_border_containedness(C_I(0,1));
|
||||
check_border_containedness(C_I(2,5));
|
||||
|
||||
check_border_containedness(C_I(0,2));
|
||||
check_border_containedness(C_I(2,5));
|
||||
check_border_containedness(C_D(0,2));
|
||||
check_border_containedness(C_D(2,5));
|
||||
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template <class T>
|
||||
void discrete_dynamic_interval_bounds_4_bicremental_types()
|
||||
{
|
||||
//CL typedef typename icl::interval<T>::type IntervalT;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*-----------------------------------------------------------------------------+
|
||||
/*-----------------------------------------------------------------------------+
|
||||
Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
+------------------------------------------------------------------------------+
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
@@ -7,7 +7,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber
|
||||
+-----------------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------------------------------+
|
||||
Function templates to call functions in object oriented or namespace glabal
|
||||
Function templates to call functions in object oriented or namespace glabal
|
||||
versions.
|
||||
+-----------------------------------------------------------------------------*/
|
||||
#ifndef BOOST_LIBS_ICL_TEST_INTERVAL_LAWS_HPP_JOFA_101011
|
||||
@@ -31,7 +31,7 @@ check_border_containedness(const Type& itv)
|
||||
domain_type lo = icl::lower(itv);
|
||||
domain_type up = icl::upper(itv);
|
||||
|
||||
//LAW: The empty set is contained in every set
|
||||
//LAW: The empty set is contained in every set
|
||||
BOOST_CHECK_EQUAL(icl::contains(itv, icl::identity_element<Type>::value()), true);
|
||||
//LAW: Reflexivity: Every interval contains itself
|
||||
BOOST_CHECK_EQUAL(icl::contains(itv, itv), true);
|
||||
@@ -82,4 +82,3 @@ check_border_containedness(const Type& itv)
|
||||
}} // namespace boost icl
|
||||
|
||||
#endif // BOOST_ICL_TEST_INTERVAL_LAWS_HPP_JOFA_100908
|
||||
|
||||
|
||||
Reference in New Issue
Block a user