diff --git a/libs/temporal/test/BBTTest.cc b/libs/temporal/test/BBTTest.cc index 032e643ded..fc287db11c 100644 --- a/libs/temporal/test/BBTTest.cc +++ b/libs/temporal/test/BBTTest.cc @@ -119,3 +119,35 @@ void BBTTest::convertTest() { } + +void +BBTTest::deltaTest () +{ + Meter m (12, 8); + BBT_Time a (5,12,0); + BBT_Time b (5,12,480); + BBT_Offset o (m.bbt_delta (b, a)); + + CPPUNIT_ASSERT_EQUAL (BBT_Offset (0, 0, 480), o); + + a = BBT_Time (5,11,959); + o = m.bbt_delta (b, a); + + CPPUNIT_ASSERT_EQUAL (BBT_Offset (0, 0, 481), o); + + a = BBT_Time (4,11,959); + o = m.bbt_delta (b, a); + + CPPUNIT_ASSERT_EQUAL (BBT_Offset (1, 0, 481), o); + + a = BBT_Time (4,6,959); + o = m.bbt_delta (b, a); + + CPPUNIT_ASSERT_EQUAL (BBT_Offset (1, 5, 481), o); + + a = BBT_Time (4,4,959); + b = BBT_Time (5,3,840); + o = m.bbt_delta (b, a); + + CPPUNIT_ASSERT_EQUAL (BBT_Offset (0, 10, 841), o); +} diff --git a/libs/temporal/test/BBTTest.h b/libs/temporal/test/BBTTest.h index 9437919be3..14845e7402 100644 --- a/libs/temporal/test/BBTTest.h +++ b/libs/temporal/test/BBTTest.h @@ -10,6 +10,7 @@ class BBTTest : public CppUnit::TestFixture CPPUNIT_TEST(multiplyTest); CPPUNIT_TEST(convertTest); CPPUNIT_TEST(roundTest); + CPPUNIT_TEST(deltaTest); CPPUNIT_TEST_SUITE_END(); public: @@ -19,4 +20,5 @@ public: void multiplyTest(); void convertTest(); void roundTest(); + void deltaTest(); };