add skeleton unit test for tempo map cut buffer

This commit is contained in:
Paul Davis 2023-05-04 18:48:50 -06:00
parent b3a127d318
commit 7f977bf3e4
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,46 @@
#include <stdlib.h>
#include "temporal/tempo.h"
#include "TempoMapCutBufferTest.h"
CPPUNIT_TEST_SUITE_REGISTRATION(TempoMapCutBufferTest);
using namespace Temporal;
void
TempoMapCutBufferTest::createTest()
{
CPPUNIT_ASSERT (TempoMap::use() != 0);
}
void
TempoMapCutBufferTest::cutTest()
{
TempoMap::WritableSharedPtr tmap (TempoMap::write_copy());
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
* 8th notes, or 18 8 notes, or 9 4th notes. So its quarter time should
* be 8 + 9 = 17
*/
std::cout << "\n\n\n ***************** tp = " << tp.beats() << std::endl;
CPPUNIT_ASSERT (tp.beats() == Beats (17,0));
tmap->abort_update ();
}
void
TempoMapCutBufferTest::copyTest()
{
}
void
TempoMapCutBufferTest::pasteTest()
{
}

View File

@ -0,0 +1,18 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
class TempoMapCutBufferTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TempoMapCutBufferTest);
CPPUNIT_TEST(createTest);
CPPUNIT_TEST(cutTest);
CPPUNIT_TEST(copyTest);
CPPUNIT_TEST(pasteTest);
CPPUNIT_TEST_SUITE_END();
public:
void createTest();
void cutTest();
void copyTest();
void pasteTest();
};

View File

@ -87,6 +87,7 @@ def build(bld):
'test/BeatTest.cc',
'test/BBTTest.cc',
'test/TempoMapTest.cc',
'test/TempoMapCutBufferTest.cc',
'test/TimelineTest.cc',
'test/RangeTest.cc',
'test/testrunner.cc',