summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-07 22:31:26 +0000
committerDavid Robillard <d@drobilla.net>2010-01-07 22:31:26 +0000
commit724bb11d5df2fd688390788ca641c92a940cb724 (patch)
tree1e35e5f6eb49b5dc96dabfce9f1d8eea74682dcb /test
parent37858603596d47b0f55b8a491fcedc626a18f963 (diff)
downloadraul-724bb11d5df2fd688390788ca641c92a940cb724.tar.gz
raul-724bb11d5df2fd688390788ca641c92a940cb724.tar.bz2
raul-724bb11d5df2fd688390788ca641c92a940cb724.zip
Tidy test output.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2370 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/quantize_test.cpp4
-rw-r--r--test/smf_test.cpp24
2 files changed, 16 insertions, 12 deletions
diff --git a/test/quantize_test.cpp b/test/quantize_test.cpp
index 39ba899..a3c30de 100644
--- a/test/quantize_test.cpp
+++ b/test/quantize_test.cpp
@@ -13,8 +13,8 @@ main()
for (double in = 0.0; in < 32; in += 0.23) {
TimeStamp beats(TimeUnit(TimeUnit::BEATS, 19200), in);
- cout << "Q(" << in << ", 1/4) = "
- << Quantizer::quantize(q, beats) << endl;
+ /*cout << "Q(" << in << ", 1/4) = "
+ << Quantizer::quantize(q, beats) << endl;*/
if (Quantizer::quantize(q, beats).subticks() % (19200/4) != 0)
return 1;
diff --git a/test/smf_test.cpp b/test/smf_test.cpp
index 40465ed..9ff27f5 100644
--- a/test/smf_test.cpp
+++ b/test/smf_test.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include <string>
+#include "raul/log.hpp"
#include "raul/SMFReader.hpp"
#include "raul/SMFWriter.hpp"
@@ -10,15 +11,21 @@ using namespace Raul;
int
main(int argc, char** argv)
{
+#define CHECK(cond) \
+ do { if (!(cond)) { \
+ error << "Test at " << __FILE__ << ":" << __LINE__ << " failed: " << __STRING(cond) << endl; \
+ return 1; \
+ } } while (0)
+
+ static const uint16_t ppqn = 19200;
+
const char* filename = NULL;
if (argc < 2) {
filename = "./test.mid";
- SMFWriter writer(TimeUnit(TimeUnit::BEATS, 19200));
+ SMFWriter writer(TimeUnit(TimeUnit::BEATS, ppqn));
writer.start(string(filename), TimeStamp(writer.unit(), 0, 0));
writer.finish();
- cout << "Wrote " << filename << " with PPQN = " << writer.unit().ppt() << endl;
-
} else {
filename = argv[1];
}
@@ -32,14 +39,11 @@ main(int argc, char** argv)
return -1;
}
- cout << "Opened SMF file " << filename << endl;
-
- cout << "Type: " << reader.type() << endl;
- cout << "Num tracks: " << reader.num_tracks() << endl;
- cout << "PPQN: " << reader.ppqn() << endl;
+ CHECK(reader.type() == 0);
+ CHECK(reader.num_tracks() == 1);
+ CHECK(reader.ppqn() == ppqn);
for (unsigned t=1; t <= reader.num_tracks(); ++t) {
- cout << "******** Track " << t << " ********" << endl;
reader.seek_to_track(t);
unsigned char buf[4];
@@ -47,7 +51,7 @@ main(int argc, char** argv)
uint32_t ev_delta_time;
while (reader.read_event(4, buf, &ev_size, &ev_delta_time) >= 0) {
- cout << "Event, size = " << ev_size << ", time = " << ev_delta_time;
+ cout << t << ": Event, size = " << ev_size << ", time = " << ev_delta_time;
cout << ":\t";
cout.flags(ios::hex);
for (uint32_t i=0; i < ev_size; ++i) {