concordia-library/concordia/t/test_interval.cpp

105 lines
2.5 KiB
C++
Raw Normal View History

#include "tests/unit-tests/unit_tests_globals.hpp"
#include "concordia/interval.hpp"
#include "concordia/common/config.hpp"
BOOST_AUTO_TEST_SUITE(interval)
BOOST_AUTO_TEST_CASE( IntervalIntersects1 )
{
Interval interval1(2,5);
Interval interval2(6,7);
BOOST_CHECK(!interval1.intersects(interval2));
BOOST_CHECK(!interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects2 )
{
Interval interval1(2,5);
Interval interval2(5,7);
BOOST_CHECK(!interval1.intersects(interval2));
BOOST_CHECK(!interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects3 )
{
Interval interval1(2,5);
Interval interval2(4,7);
BOOST_CHECK(interval1.intersects(interval2));
BOOST_CHECK(interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects4 )
{
Interval interval1(3,5);
Interval interval2(3,7);
BOOST_CHECK(interval1.intersects(interval2));
BOOST_CHECK(interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects5 )
{
Interval interval1(4,5);
Interval interval2(3,7);
BOOST_CHECK(interval1.intersects(interval2));
BOOST_CHECK(interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects6 )
{
Interval interval1(4,9);
Interval interval2(3,7);
BOOST_CHECK(interval1.intersects(interval2));
BOOST_CHECK(interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects7 )
{
Interval interval1(7,9);
Interval interval2(3,7);
BOOST_CHECK(!interval1.intersects(interval2));
BOOST_CHECK(!interval2.intersects(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalIntersects8 )
{
Interval interval1(8,9);
Interval interval2(3,7);
BOOST_CHECK(!interval1.intersects(interval2));
BOOST_CHECK(!interval2.intersects(interval1));
}
2018-12-12 21:45:07 +01:00
BOOST_AUTO_TEST_CASE( IntervalContains1 )
{
Interval interval1(2,9);
Interval interval2(3,7);
BOOST_CHECK(interval1.contains(interval2));
BOOST_CHECK(!interval2.contains(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalContains2 )
{
Interval interval1(3,9);
Interval interval2(3,7);
BOOST_CHECK(interval1.contains(interval2));
BOOST_CHECK(!interval2.contains(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalContains3 )
{
Interval interval1(4,9);
Interval interval2(3,7);
BOOST_CHECK(!interval1.contains(interval2));
BOOST_CHECK(!interval2.contains(interval1));
}
BOOST_AUTO_TEST_CASE( IntervalContains4 )
{
Interval interval1(2,9);
Interval interval2(3,17);
BOOST_CHECK(!interval1.contains(interval2));
BOOST_CHECK(!interval2.contains(interval1));
}
BOOST_AUTO_TEST_SUITE_END()