From ee64390c484fd6ff13ed9b69e9ff629d4bb9abd3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 15 Feb 2023 17:51:28 -0700 Subject: [PATCH] fix libtemporal tests after API changes to the library --- libs/temporal/test/BBTTest.cc | 58 +++++++++++++++--------------- libs/temporal/test/TempoMapTest.cc | 4 +-- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/libs/temporal/test/BBTTest.cc b/libs/temporal/test/BBTTest.cc index 9e066e5002..032e643ded 100644 --- a/libs/temporal/test/BBTTest.cc +++ b/libs/temporal/test/BBTTest.cc @@ -12,25 +12,25 @@ using namespace Temporal; void BBTTest::createTest() { - CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-bar BBT_Time;", BBT_Time (0, 1, 0), IllegalBBTTimeException); - CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-beat BBT_Time;", BBT_Time (1, 0, 0), IllegalBBTTimeException); - CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-bar-and-beat BBT_Time;", BBT_Time (0, 0, 0), IllegalBBTTimeException); + CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-bar BBT_Argument;", BBT_Argument (0, 1, 0), IllegalBBTTimeException); + CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-beat BBT_Argument;", BBT_Argument (1, 0, 0), IllegalBBTTimeException); + CPPUNIT_ASSERT_THROW_MESSAGE ("- zero-bar-and-beat BBT_Argument;", BBT_Argument (0, 0, 0), IllegalBBTTimeException); - /* This test checks that BBT_Time cannot convert ticks to beats etc., so the explicit 1920 ticks remains - that in the constructed BBT_Time, rather than being converted to an additional beat. This has to be true - because BBT_Time has no clue what the meter is. + /* This test checks that BBT_Argument cannot convert ticks to beats etc., so the explicit 1920 ticks remains + that in the constructed BBT_Argument, rather than being converted to an additional beat. This has to be true + because BBT_Argument has no clue what the meter is. */ - BBT_Time a (1, 1, 1920); - CPPUNIT_ASSERT(BBT_Time (1,2,0) != a); + BBT_Argument a (1, 1, 1920); + CPPUNIT_ASSERT(BBT_Argument (1,2,0) != a); - /* by contrast, a zero-distance "walk" from that location should return a canonicalized BBT_Time, which given a 4/4 meter + /* by contrast, a zero-distance "walk" from that location should return a canonicalized BBT_Argument, which given a 4/4 meter will be 1|2|0 */ TempoMap::SharedPtr tmap (TempoMap::fetch()); BBT_Offset b (0, 0, 0); - BBT_Time r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,2,0), r); + BBT_Argument r = tmap->bbt_walk (a, b); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,2,0), r); } @@ -38,44 +38,44 @@ void BBTTest::addTest() { TempoMap::SharedPtr tmap (TempoMap::fetch()); - BBT_Time a(1,1,0); + BBT_Argument a(1,1,0); BBT_Offset b(1,0,0); - BBT_Time r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (2,1,0), r); + BBT_Argument r = tmap->bbt_walk (a, b); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (2,1,0), r); b = BBT_Offset (0, 1, 0); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,2,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,2,0), r); b = BBT_Offset (0, 0, 1); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,1,1), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,1,1), r); b = BBT_Offset (0, 0, ticks_per_beat - 1); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,1,ticks_per_beat - 1), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,1,ticks_per_beat - 1), r); b = BBT_Offset (0, 0, ticks_per_beat); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,2,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,2,0), r); b = BBT_Offset (0, 0, ticks_per_beat * 2); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,3,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,3,0), r); /* assumes 4/4 time */ b = BBT_Offset (0, 4, 0); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (2,1,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (2,1,0), r); b = BBT_Offset (1, 0, 0); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (2,1,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (2,1,0), r); b = BBT_Offset (0, 0, ticks_per_beat * 4); r = tmap->bbt_walk (a, b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (2,1,0), r); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (2,1,0), r); } @@ -83,26 +83,26 @@ void BBTTest::subtractTest() { TempoMap::SharedPtr tmap (TempoMap::fetch()); - BBT_Time a (1,1,0); + BBT_Argument a (1,1,0); BBT_Offset b (1,0,0); - BBT_Time r = tmap->bbt_walk (a, -b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (-1,1,0), r); + BBT_Argument r = tmap->bbt_walk (a, -b); + CPPUNIT_ASSERT_EQUAL(BBT_Argument (-1,1,0), r); b = BBT_Offset (0, 1, 0); r = tmap->bbt_walk (a, -b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,-1,0), r); /* Not sure this is actually the correct answer */ + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,-1,0), r); /* Not sure this is actually the correct answer */ b = BBT_Offset (0, 0, 1); r = tmap->bbt_walk (a, -b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,1,-1), r); /* Not sure this is actually the correct answer */ + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,1,-1), r); /* Not sure this is actually the correct answer */ b = BBT_Offset (0, 0, ticks_per_beat); r = tmap->bbt_walk (a, -b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,1,-ticks_per_beat), r); /* Not sure this is actually the correct answer */ + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,1,-ticks_per_beat), r); /* Not sure this is actually the correct answer */ b = BBT_Offset (0, 0, ticks_per_beat + 1); r = tmap->bbt_walk (a, -b); - CPPUNIT_ASSERT_EQUAL(BBT_Time (1,1,-(ticks_per_beat+1)), r); /* Not sure this is actually the correct answer */ + CPPUNIT_ASSERT_EQUAL(BBT_Argument (1,1,-(ticks_per_beat+1)), r); /* Not sure this is actually the correct answer */ } void diff --git a/libs/temporal/test/TempoMapTest.cc b/libs/temporal/test/TempoMapTest.cc index df7b323e7c..6789c68c42 100644 --- a/libs/temporal/test/TempoMapTest.cc +++ b/libs/temporal/test/TempoMapTest.cc @@ -18,8 +18,8 @@ void TempoMapTest::addTest() { TempoMap::WritableSharedPtr tmap (TempoMap::write_copy()); - TempoPoint& tp = tmap->set_tempo (Tempo (180, 4), BBT_Time (6, 1, 0)); - tmap->set_meter (Meter (6, 8), BBT_Time (3, 1, 0)); + TempoPoint& tp = tmap->set_tempo (Tempo (180, 4), BBT_Argument (6, 1, 0)); + tmap->set_meter (Meter (6, 8), BBT_Argument (3, 1, 0)); /* tp is at 6|1|0 which is 3|0|0 after the 6/8 meter at ((3-1) * 4 =) 8 * quarter notes), so 3 bars of 6