From 1976442a2d8f6ac3a8beec5f1368c81445d4e42b Mon Sep 17 00:00:00 2001 From: jofaber Date: Sat, 2 Jun 2018 15:13:06 +0200 Subject: [PATCH] added code for span and hull from docs. --- test/fix_tickets_/fix_tickets.cpp | 9 ++++++--- test/test_icl_discrete_interval.hpp | 4 ++-- test/test_icl_dynamic_interval.hpp | 12 ++++++------ test/test_interval_laws.hpp | 7 +++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/test/fix_tickets_/fix_tickets.cpp b/test/fix_tickets_/fix_tickets.cpp index 6e1ddc7..0b5c7c8 100644 --- a/test/fix_tickets_/fix_tickets.cpp +++ b/test/fix_tickets_/fix_tickets.cpp @@ -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 >(-1,2) - , hull< right_open_interval >(-1,2) ); + BOOST_CHECK_EQUAL( span< right_open_interval >(2,1) + , construct< right_open_interval >(1,2) ); + + BOOST_CHECK_EQUAL( hull< right_open_interval >(2,1) + , construct< right_open_interval >(1,3) ); } diff --git a/test/test_icl_discrete_interval.hpp b/test/test_icl_discrete_interval.hpp index b60477e..e7aea27 100644 --- a/test/test_icl_discrete_interval.hpp +++ b/test/test_icl_discrete_interval.hpp @@ -32,8 +32,8 @@ void distant_intervals_4_discrete_types() { typedef right_open_interval L__D; // L__D for [..) typedef left_open_interval C__I; // C__I for (..] - typedef closed_interval L__I; // L__I for [..] - typedef open_interval C__D; // C__D for (..) + typedef closed_interval L__I; // L__I for [..] + typedef open_interval C__D; // C__D for (..) typedef typename icl::interval::type IntervalT; BOOST_CHECK( is_interval::value ); diff --git a/test/test_icl_dynamic_interval.hpp b/test/test_icl_dynamic_interval.hpp index 554a8f3..dcafcfa 100644 --- a/test/test_icl_dynamic_interval.hpp +++ b/test/test_icl_dynamic_interval.hpp @@ -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 +template void dynamic_interval_ctor_4_ordered_types() { typedef typename domain_type_of >::type T; @@ -24,7 +24,7 @@ void dynamic_interval_ctor_4_ordered_types() BOOST_CHECK_EQUAL(IntervalT(), IntervalT(icl::identity_element::value(), icl::identity_element::value(), interval_bounds::right_open())); } -template +template void dynamic_interval_bounds_4_bicremental_types() { typedef typename icl::interval::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 +template void discrete_dynamic_interval_bounds_4_bicremental_types() { //CL typedef typename icl::interval::type IntervalT; diff --git a/test/test_interval_laws.hpp b/test/test_interval_laws.hpp index f937688..587588e 100644 --- a/test/test_interval_laws.hpp +++ b/test/test_interval_laws.hpp @@ -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::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 -