summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dgxmlparsertest.cc7
-rw-r--r--test/domloadertest.cc40
-rw-r--r--test/drumkit_creator.cc8
3 files changed, 29 insertions, 26 deletions
diff --git a/test/dgxmlparsertest.cc b/test/dgxmlparsertest.cc
index 16bcbd2..30bcfa7 100644
--- a/test/dgxmlparsertest.cc
+++ b/test/dgxmlparsertest.cc
@@ -43,7 +43,7 @@ public:
{
ScopedFile scoped_file(
"<?xml version='1.0' encoding='UTF-8'?>\n" \
- "<instrument version=\"2.0\" name=\"Snare\">\n" \
+ "<instrument version=\"2.0\" name=\"Snare\" description=\"A nice snare\">\n" \
" <channels>\n" \
" <channel name=\"AmbLeft\" main=\"true\"/>\n" \
" <channel name=\"AmbRight\" main=\"false\"/>\n" \
@@ -70,6 +70,8 @@ public:
DGUNIT_ASSERT(parseInstrumentFile(scoped_file.filename(), dom));
DGUNIT_ASSERT_EQUAL(std::string("Snare"), dom.name);
+ DGUNIT_ASSERT_EQUAL(std::string("2.0"), dom.version);
+ DGUNIT_ASSERT_EQUAL(std::string("A nice snare"), dom.description);
DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.samples.size());
{
@@ -130,7 +132,7 @@ public:
{
ScopedFile scoped_file(
"<?xml version='1.0' encoding='UTF-8'?>\n" \
- "<drumkit name=\"CrocellKit\" description=\"my description\" samplerate=\"48000\" version=\"2.0.0\">\n" \
+ "<drumkit name=\"CrocellKit\" description=\"my description\" samplerate=\"48000\" version=\"2.0\">\n" \
" <channels>\n" \
" <channel name=\"AmbLeft\"/>\n" \
" <channel name=\"AmbRight\"/>\n" \
@@ -158,6 +160,7 @@ public:
DGUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), dom));
DGUNIT_ASSERT_EQUAL(std::string("CrocellKit"), dom.name);
+ DGUNIT_ASSERT_EQUAL(std::string("2.0"), dom.version);
DGUNIT_ASSERT_EQUAL(std::string("my description"), dom.description);
DGUNIT_ASSERT_EQUAL(48000.0, dom.samplerate);
DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.instruments.size());
diff --git a/test/domloadertest.cc b/test/domloadertest.cc
index 2c9c5eb..69b9821 100644
--- a/test/domloadertest.cc
+++ b/test/domloadertest.cc
@@ -52,7 +52,7 @@ public:
{
ScopedFile scoped_instrument_file1(
"<?xml version='1.0' encoding='UTF-8'?>\n" \
- "<instrument version=\"2.0\" name=\"Snare\">\n" \
+ "<instrument version=\"2.0\" name=\"Snare1\">\n" \
" <samples>\n" \
" <sample name=\"Snare-1\" power=\"0.00985718\">\n" \
" <audiofile channel=\"AmbLeft\" file=\"1-Snare.wav\" filechannel=\"1\"/>\n" \
@@ -71,7 +71,7 @@ public:
ScopedFile scoped_instrument_file2(
"<?xml version='1.0' encoding='UTF-8'?>\n" \
- "<instrument version=\"2.0\" name=\"Snare\">\n" \
+ "<instrument version=\"2.0\" name=\"Snare2\">\n" \
" <samples>\n" \
" <sample name=\"Snare-1\" power=\"0.00985718\">\n" \
" <audiofile channel=\"AmbLeft2\" file=\"1-Snare.wav\" filechannel=\"1\"/>\n" \
@@ -152,7 +152,7 @@ public:
{
auto& instrument = *drumkit.instruments[0];
DGUNIT_ASSERT_EQUAL(std::string(""), instrument._group);
- DGUNIT_ASSERT_EQUAL(std::string("Snare"), instrument._name);
+ DGUNIT_ASSERT_EQUAL(std::string("Snare1"), instrument._name);
DGUNIT_ASSERT_EQUAL(std::string(""), instrument._description);
DGUNIT_ASSERT(VersionStr("2.0.0") == instrument.version);
@@ -172,19 +172,19 @@ public:
// NOTE: Channel numbers are zero based - they are 1 based in the xml
case 0:
DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 1:
DGUNIT_ASSERT_EQUAL(std::string("AmbRight"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 11:
DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 12:
DGUNIT_ASSERT_EQUAL(std::string("SnareTop"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
default:
DGUNIT_ASSERT(false);
@@ -206,19 +206,19 @@ public:
// NOTE: Channel numbers are zero based - they are 1 based in the xml
case 0:
DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 1:
DGUNIT_ASSERT_EQUAL(std::string("AmbRight"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 11:
DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 12:
DGUNIT_ASSERT_EQUAL(std::string("SnareTop"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
default:
DGUNIT_ASSERT(false);
@@ -235,7 +235,7 @@ public:
{
auto& instrument = *drumkit.instruments[1];
DGUNIT_ASSERT_EQUAL(std::string(""), instrument._group);
- DGUNIT_ASSERT_EQUAL(std::string("Snare"), instrument._name);
+ DGUNIT_ASSERT_EQUAL(std::string("Snare2"), instrument._name);
DGUNIT_ASSERT_EQUAL(std::string(""), instrument._description);
DGUNIT_ASSERT(VersionStr("2.0.0") == instrument.version);
@@ -255,19 +255,19 @@ public:
// NOTE: Channel numbers are zero based - they are 1 based in the xml
case 0:
DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 1:
DGUNIT_ASSERT_EQUAL(std::string("AmbRight"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 11:
DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 12:
DGUNIT_ASSERT_EQUAL(std::string("SnareTop"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
default:
DGUNIT_ASSERT(false);
@@ -289,19 +289,19 @@ public:
// NOTE: Channel numbers are zero based - they are 1 based in the xml
case 0:
DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 1:
DGUNIT_ASSERT_EQUAL(std::string("AmbRight"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 11:
DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
case 12:
DGUNIT_ASSERT_EQUAL(std::string("SnareTop"),
- audiofile.second->instrument_channel->name);
+ audiofile.second->instrument_channel->name);
break;
default:
DGUNIT_ASSERT(false);
diff --git a/test/drumkit_creator.cc b/test/drumkit_creator.cc
index c4d8ff1..7a0291c 100644
--- a/test/drumkit_creator.cc
+++ b/test/drumkit_creator.cc
@@ -304,7 +304,7 @@ void DrumkitCreator::createInstrument(const InstrumentData& data, std::size_t nu
const std::string& dir)
{
std::string prefix = "<?xml version='1.0' encoding='UTF-8'?>\n"
- "<instrument name=\"" + data.name + "\">\n";
+ "<instrument name=\"" + data.name + "\" version=\"2.0\">\n";
// FIXME sampleref
std::string postfix = "<velocities>\n"
"<velocity lower=\"0\" upper=\"1\">\n"
@@ -347,8 +347,8 @@ std::string DrumkitCreator::createDrumkitFile(const DrumkitData& data, const std
{
// Pre- and postfix string
std::string prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<drumkit name=\"" + data.name + "\" description=\"An drumkit generated"
- " by the drumkit_generator\">\n";
+ "<drumkit name=\"" + data.name + "\" version=\"2.0\""
+ " description=\"An drumkit generated by the drumkit_generator\">\n";
std::string postfix = "</drumkit>\n";
// Channel string
@@ -359,7 +359,7 @@ std::string DrumkitCreator::createDrumkitFile(const DrumkitData& data, const std
channels += "<channel name=\"ch" + std::to_string(i) + "\"/>\n";
}
channels += "</channels>\n";
-
+
// Instrument string
std::string instruments;
instruments += "<instruments>\n";