fix libtemporal tests after API changes to the library
This commit is contained in:
parent
644ebe37a8
commit
ee64390c48
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user