add unit test for Meter::bbt_delta()

This commit is contained in:
Paul Davis 2025-08-22 10:43:46 -06:00
parent a6b07256aa
commit 26e63fca9b
2 changed files with 34 additions and 0 deletions

View file

@ -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);
}

View file

@ -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();
};