summaryrefslogtreecommitdiff
path: root/libs/evoral/test
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2014-11-30 11:17:58 +0000
committerColin Fletcher <colin.m.fletcher@googlemail.com>2014-12-01 16:52:58 +0000
commit47d329ca408a214d1ac65785dc33ff9a4a06337f (patch)
tree37268e31c20b97420c3af53a5290240ceb73fd50 /libs/evoral/test
parent0c7dd8223991465b442ce276887cf86b00dde31e (diff)
Make tests of Evoral::Range functions include both endpoints in Range
Some of the tests for Evoral::RangeList::subtract() assume that ranges don't contain their end (->to) point. This appears inconsistent with how they are used elsewhere. Add some ASCII art comments to the tests to try to clarify what they're really testing for, and amend subtractTest1, subtractTest4, & subtractTest5 to incorporate the assumption that ranges include their end points.
Diffstat (limited to 'libs/evoral/test')
-rw-r--r--libs/evoral/test/RangeTest.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/libs/evoral/test/RangeTest.cpp b/libs/evoral/test/RangeTest.cpp
index 409e40f013..bbb2bdeb58 100644
--- a/libs/evoral/test/RangeTest.cpp
+++ b/libs/evoral/test/RangeTest.cpp
@@ -29,6 +29,13 @@ RangeTest::coalesceTest ()
void
RangeTest::subtractTest1 ()
{
+
+/* 01234567890
+ * fred: |---------|
+ * jim: |-| ||
+ * sheila: || || ||
+ */
+
Range<int> fred (0, 10);
RangeList<int> jim;
@@ -45,11 +52,11 @@ RangeTest::subtractTest1 ()
CPPUNIT_ASSERT_EQUAL (1, i->to);
++i;
- CPPUNIT_ASSERT_EQUAL (4, i->from);
+ CPPUNIT_ASSERT_EQUAL (5, i->from);
CPPUNIT_ASSERT_EQUAL (6, i->to);
++i;
- CPPUNIT_ASSERT_EQUAL (8, i->from);
+ CPPUNIT_ASSERT_EQUAL (9, i->from);
CPPUNIT_ASSERT_EQUAL (10, i->to);
}
@@ -93,6 +100,13 @@ RangeTest::subtractTest3 ()
void
RangeTest::subtractTest4 ()
{
+/* 01234567890
+ * fred: |---------|
+ * jim: |-| ||
+ * ||
+ * sheila: || || |
+ */
+
Range<int> fred (0, 10);
RangeList<int> jim;
@@ -110,11 +124,11 @@ RangeTest::subtractTest4 ()
CPPUNIT_ASSERT_EQUAL (1, i->to);
++i;
- CPPUNIT_ASSERT_EQUAL (4, i->from);
+ CPPUNIT_ASSERT_EQUAL (5, i->from);
CPPUNIT_ASSERT_EQUAL (6, i->to);
++i;
- CPPUNIT_ASSERT_EQUAL (9, i->from);
+ CPPUNIT_ASSERT_EQUAL (10, i->from);
CPPUNIT_ASSERT_EQUAL (10, i->to);
}
@@ -125,6 +139,12 @@ RangeTest::subtractTest4 ()
void
RangeTest::subtractTest5 ()
{
+/* 01234567890123
+ * fred: |----------|
+ * jim: |---| || |------...
+ * sheila:i | |
+ */
+
Range<int> fred (1, 12);
RangeList<int> jim;
@@ -138,11 +158,11 @@ RangeTest::subtractTest5 ()
CPPUNIT_ASSERT_EQUAL (size_t (2), s.size ());
RangeList<int>::List::iterator i = s.begin ();
- CPPUNIT_ASSERT_EQUAL (4, i->from);
+ CPPUNIT_ASSERT_EQUAL (5, i->from);
CPPUNIT_ASSERT_EQUAL (5, i->to);
++i;
- CPPUNIT_ASSERT_EQUAL (7, i->from);
+ CPPUNIT_ASSERT_EQUAL (8, i->from);
CPPUNIT_ASSERT_EQUAL (8, i->to);
}