diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-09-19 15:12:08 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-09-19 15:14:24 +0200 |
commit | 62e577cee9e199692d15cf741c0e29ae28f25c52 (patch) | |
tree | 3cfe20ce434b986e58efbc9bececcda41502ed33 /test | |
parent | 19ac4649f16621430b7d34635410fd67fd8ef49e (diff) |
Make use of uUnit as a submodule (dgunit renamed).
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 99 | ||||
-rw-r--r-- | test/atomictest.cc | 84 | ||||
-rw-r--r-- | test/audiocacheeventhandlertest.cc | 6 | ||||
-rw-r--r-- | test/audiocachefiletest.cc | 38 | ||||
-rw-r--r-- | test/audiocacheidmanagertest.cc | 40 | ||||
-rw-r--r-- | test/audiocachetest.cc | 20 | ||||
-rw-r--r-- | test/bytesizeparsertest.cc | 50 | ||||
-rw-r--r-- | test/configparsertest.cc | 20 | ||||
-rw-r--r-- | test/configtest.cc | 92 | ||||
-rw-r--r-- | test/dgtest.cc | 6 | ||||
-rw-r--r-- | test/dgxmlparsertest.cc | 346 | ||||
-rw-r--r-- | test/domloadertest.cc | 150 | ||||
-rw-r--r-- | test/drumkitcreatortest.cc | 6 | ||||
-rw-r--r-- | test/enginetest.cc | 6 | ||||
-rw-r--r-- | test/eventsdstest.cc | 32 | ||||
-rw-r--r-- | test/framesizetest.cc | 26 | ||||
-rw-r--r-- | test/imagecachetest.cc | 34 | ||||
-rw-r--r-- | test/lv2.cc | 76 | ||||
-rw-r--r-- | test/midimapparsertest.cc | 32 | ||||
-rw-r--r-- | test/notifiertest.cc | 18 | ||||
-rw-r--r-- | test/paintertest.cc | 8 | ||||
-rw-r--r-- | test/powermaptest.cc | 8 | ||||
-rw-r--r-- | test/randomtest.cc | 26 | ||||
-rw-r--r-- | test/resource_test.cc | 28 | ||||
-rw-r--r-- | test/semaphoretest.cc | 14 | ||||
-rw-r--r-- | test/syncedsettings.cc | 60 | ||||
-rw-r--r-- | test/translationtest.cc | 20 | ||||
m--------- | test/uunit | 0 |
28 files changed, 685 insertions, 660 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 372b57f..2ed1fdc 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -25,9 +25,8 @@ if ENABLE_LV2 TESTS += lv2 endif -check_PROGRAMS = $(TESTS) - -resource_CXXFLAGS = -DOUTPUT=\"resource\" $(SNDFILE_CFLAGS) \ +check_PROGRAMS = $(TESTS) +resource_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"resource\" $(SNDFILE_CFLAGS) \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/plugingui \ @@ -39,11 +38,11 @@ resource_SOURCES = \ $(top_srcdir)/plugingui/resource.cc \ $(top_srcdir)/hugin/hugin.c \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ resource_test.cc -audiocache_CXXFLAGS = -DOUTPUT=\"audiocache\" \ +audiocache_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocache\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) @@ -57,11 +56,11 @@ audiocache_SOURCES = \ $(top_srcdir)/src/sem.cc \ $(top_srcdir)/src/audiofile.cc \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ audiocachetest.cc -audiocachefile_CXXFLAGS = -DOUTPUT=\"audiocachefile\" \ +audiocachefile_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocachefile\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) @@ -72,21 +71,21 @@ audiocachefile_SOURCES = \ $(top_srcdir)/src/sem.cc \ $(top_srcdir)/src/audiofile.cc \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ audiocachefiletest.cc -audiocacheidmanager_CXXFLAGS = -DOUTPUT=\"audiocacheidmanager\" \ +audiocacheidmanager_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheidmanager\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(SNDFILE_CFLAGS) audiocacheidmanager_LDFLAGS = $(SNDFILE_LIBS) audiocacheidmanager_SOURCES = \ $(top_srcdir)/src/audiocacheidmanager.cc \ - dgtest.cc \ + uunit/uunit.cc \ audiocacheidmanagertest.cc -audiocacheeventhandler_CXXFLAGS = -DOUTPUT=\"audiocacheeventhandler\" \ +audiocacheeventhandler_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheeventhandler\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) @@ -97,10 +96,10 @@ audiocacheeventhandler_SOURCES = \ $(top_srcdir)/src/audiocachefile.cc \ $(top_srcdir)/src/thread.cc \ $(top_srcdir)/src/sem.cc \ - dgtest.cc \ + uunit/uunit.cc \ audiocacheeventhandlertest.cc -enginetest_CXXFLAGS = -DOUTPUT=\"enginetest\" \ +enginetest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"enginetest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) @@ -108,21 +107,21 @@ enginetest_LDFLAGS = $(PTHREAD_LIBS) $(SNDFILE_LIBS) \ $(top_builddir)/src/libdg.la enginetest_SOURCES = \ $(top_srcdir)/hugin/hugin.c \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ enginetest.cc -paintertest_CXXFLAGS = -DOUTPUT=\"paintertest\" \ +paintertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"paintertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/plugingui \ -I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) paintertest_LDFLAGS = $(top_builddir)/plugingui/libdggui.la paintertest_SOURCES = \ $(top_srcdir)/hugin/hugin.c \ - dgtest.cc \ + uunit/uunit.cc \ paintertest.cc -lv2_CXXFLAGS = -DOUTPUT=\"lv2\" \ +lv2_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"lv2\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ `pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \ @@ -132,12 +131,12 @@ lv2_LDFLAGS = `pkg-config --libs serd-0` \ $(SNDFILE_LIBS) lv2_SOURCES = \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ lv2_test_host.cc \ lv2.cc -configfile_CXXFLAGS = -DOUTPUT=\"configfile\" \ +configfile_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"configfile\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/hugin -I$(top_srcdir)/src configfile_LDFLAGS = @@ -145,10 +144,10 @@ configfile_SOURCES = \ $(top_srcdir)/src/configfile.cc \ $(top_srcdir)/src/directory.cc \ $(top_srcdir)/hugin/hugin.c \ - dgtest.cc \ + uunit/uunit.cc \ configtest.cc -randomtest_CXXFLAGS = -DOUTPUT=\"randomtest\" \ +randomtest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"randomtest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN @@ -156,31 +155,31 @@ randomtest_CFLAGS = -DDISABLE_HUGIN randomtest_LDFLAGS = randomtest_SOURCES = \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ randomtest.cc -atomictest_CXXFLAGS = -DOUTPUT=\"atomictest\" \ +atomictest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"atomictest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin atomictest_LDFLAGS = -atomictest_SOURCES = atomictest.cc dgtest.cc +atomictest_SOURCES = atomictest.cc uunit/uunit.cc -syncedsettingstest_CXXFLAGS = -DOUTPUT=\"syncedsettingstest\" \ +syncedsettingstest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"syncedsettingstest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin syncedsettingstest_LDFLAGS = -syncedsettingstest_SOURCES = syncedsettings.cc dgtest.cc +syncedsettingstest_SOURCES = syncedsettings.cc uunit/uunit.cc -imagecachetest_CXXFLAGS = -DOUTPUT=\"imagecachetest\" \ +imagecachetest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"imagecachetest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/plugingui -I$(top_srcdir)/hugin imagecachetest_LDFLAGS = $(top_builddir)/plugingui/libdggui.la imagecachetest_SOURCES = \ $(top_srcdir)/hugin/hugin.c \ imagecachetest.cc \ - dgtest.cc + uunit/uunit.cc -semaphoretest_CXXFLAGS = -DOUTPUT=\"semaphoretest\" \ +semaphoretest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"semaphoretest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) semaphoretest_LDFLAGS = $(PTHREAD_LIBS) @@ -188,9 +187,9 @@ semaphoretest_SOURCES = \ $(top_srcdir)/hugin/hugin.c \ $(top_srcdir)/src/sem.cc \ semaphoretest.cc \ - dgtest.cc + uunit/uunit.cc -drumkitcreatortest_CXXFLAGS = -DOUTPUT=\"drumkitcreatortest\" \ +drumkitcreatortest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"drumkitcreatortest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(SNDFILE_CFLAGS) @@ -198,28 +197,28 @@ drumkitcreatortest_CFLAGS = -DDISABLE_HUGIN drumkitcreatortest_LDFLAGS = $(SNDFILE_LIBS) drumkitcreatortest_SOURCES = \ $(top_srcdir)/src/random.cc \ - dgtest.cc \ + uunit/uunit.cc \ drumkit_creator.cc \ drumkitcreatortest.cc -bytesizeparsertest_CXXFLAGS = -DOUTPUT=\"bytesizeparsertest\" \ +bytesizeparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"bytesizeparsertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src bytesizeparsertest_LDFLAGS = bytesizeparsertest_SOURCES = \ $(top_srcdir)/src/bytesizeparser.cc \ bytesizeparsertest.cc \ - dgtest.cc + uunit/uunit.cc -notifiertest_CXXFLAGS = -DOUTPUT=\"notifiertest\" \ +notifiertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"notifiertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src notifiertest_LDFLAGS = notifiertest_SOURCES = \ notifiertest.cc \ - dgtest.cc + uunit/uunit.cc -dgxmlparsertest_CXXFLAGS = -DOUTPUT=\"dgxmlparsertest\" \ +dgxmlparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"dgxmlparsertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin \ -I$(top_srcdir)/pugixml/src @@ -230,9 +229,9 @@ dgxmlparsertest_SOURCES = \ $(top_srcdir)/pugixml/src/pugixml.cpp \ dgxmlparsertest.cc \ scopedfile.cc \ - dgtest.cc + uunit/uunit.cc -domloadertest_CXXFLAGS = -DOUTPUT=\"domloadertest\" \ +domloadertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"domloadertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src domloadertest_LDFLAGS = \ @@ -241,9 +240,9 @@ domloadertest_SOURCES = \ $(top_srcdir)/hugin/hugin.c \ domloadertest.cc \ scopedfile.cc \ - dgtest.cc + uunit/uunit.cc -configparsertest_CXXFLAGS = -DOUTPUT=\"configparsertest\" \ +configparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"configparsertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin \ -I$(top_srcdir)/pugixml/src @@ -253,9 +252,9 @@ configparsertest_SOURCES = \ $(top_srcdir)/src/configparser.cc \ $(top_srcdir)/pugixml/src/pugixml.cpp \ configparsertest.cc \ - dgtest.cc + uunit/uunit.cc -midimapparsertest_CXXFLAGS = -DOUTPUT=\"midimapparsertest\" \ +midimapparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"midimapparsertest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/hugin \ -I$(top_srcdir)/pugixml/src @@ -266,25 +265,25 @@ midimapparsertest_SOURCES = \ $(top_srcdir)/pugixml/src/pugixml.cpp \ scopedfile.cc \ midimapparsertest.cc \ - dgtest.cc + uunit/uunit.cc -eventsdstest_CXXFLAGS = -DOUTPUT=\"eventsdstest\" \ +eventsdstest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"eventsdstest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src eventsdstest_LDFLAGS = eventsdstest_SOURCES = \ $(top_srcdir)/src/events_ds.cc \ eventsdstest.cc \ - dgtest.cc + uunit/uunit.cc -powermaptest_CXXFLAGS = -DOUTPUT=\"powermaptest\" \ +powermaptest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"powermaptest\" \ $(DEBUG_FLAGS) \ -I$(top_srcdir)/src powermaptest_LDFLAGS = powermaptest_SOURCES = \ $(top_srcdir)/src/powermap.cc \ powermaptest.cc \ - dgtest.cc + uunit/uunit.cc RES = \ $(top_srcdir)/test/locale/da.mo @@ -296,7 +295,7 @@ rcgen_verbose_0 = @echo " RCGEN "$@; translationtest_resource_data.cc: $(top_builddir)/plugingui/rcgen $(RES) $(rcgen_verbose)$(top_builddir)/plugingui/rcgen$(EXEEXT) -s $(top_srcdir)/test/ -o $@ $(RES) -translationtest_CXXFLAGS = \ +translationtest_CXXFLAGS = -I$(top_srcdir)/test/uunit \ -DOUTPUT=\"translationtest\" \ -I$(top_srcdir)/plugingui \ -I$(top_srcdir)/src \ @@ -312,7 +311,7 @@ translationtest_SOURCES = \ $(top_srcdir)/src/translation.cc \ $(top_srcdir)/plugingui/uitranslation.cc \ translationtest.cc \ - dgtest.cc + uunit/uunit.cc BUILT_SOURCES = translationtest_resource_data.cc CLEANFILES = translationtest_resource_data.cc diff --git a/test/atomictest.cc b/test/atomictest.cc index 223c6f3..fd6a249 100644 --- a/test/atomictest.cc +++ b/test/atomictest.cc @@ -24,46 +24,46 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <atomic.h> class AtomicTest - : public DGUnit + : public uUnit { public: AtomicTest() { - DGUNIT_TEST(AtomicTest::podAtomicsUseStandardImpl); - DGUNIT_TEST(AtomicTest::nonPodAtomicsUseOwnImpl); - DGUNIT_TEST(AtomicTest::podAtomicCanBeDefaultInitialized); - DGUNIT_TEST(AtomicTest::nonPodAtomicCanBeDefaultInitialized); - DGUNIT_TEST(AtomicTest::podAtomicCanBeValueInitialized); - DGUNIT_TEST(AtomicTest::nonPodAtomicCanBeValueInitialized); - DGUNIT_TEST(AtomicTest::podAtomicCanBeValueAssigned); - DGUNIT_TEST(AtomicTest::nonPodAtomicCanBeValueAssigned); - DGUNIT_TEST(AtomicTest::podAtomicsAreLockFree); + uUNIT_TEST(AtomicTest::podAtomicsUseStandardImpl); + uUNIT_TEST(AtomicTest::nonPodAtomicsUseOwnImpl); + uUNIT_TEST(AtomicTest::podAtomicCanBeDefaultInitialized); + uUNIT_TEST(AtomicTest::nonPodAtomicCanBeDefaultInitialized); + uUNIT_TEST(AtomicTest::podAtomicCanBeValueInitialized); + uUNIT_TEST(AtomicTest::nonPodAtomicCanBeValueInitialized); + uUNIT_TEST(AtomicTest::podAtomicCanBeValueAssigned); + uUNIT_TEST(AtomicTest::nonPodAtomicCanBeValueAssigned); + uUNIT_TEST(AtomicTest::podAtomicsAreLockFree); } void podAtomicsUseStandardImpl() { - DGUNIT_ASSERT(isUsingStandardImpl<bool>()); - DGUNIT_ASSERT(isUsingStandardImpl<unsigned short int>()); - DGUNIT_ASSERT(isUsingStandardImpl<short int>()); - DGUNIT_ASSERT(isUsingStandardImpl<unsigned int>()); - DGUNIT_ASSERT(isUsingStandardImpl<int>()); - DGUNIT_ASSERT(isUsingStandardImpl<unsigned long int>()); - DGUNIT_ASSERT(isUsingStandardImpl<long int>()); - DGUNIT_ASSERT(isUsingStandardImpl<unsigned long long int>()); - DGUNIT_ASSERT(isUsingStandardImpl<long long int>()); - DGUNIT_ASSERT(isUsingStandardImpl<float>()); - DGUNIT_ASSERT(isUsingStandardImpl<double>()); - DGUNIT_ASSERT(isUsingStandardImpl<long double>()); + uUNIT_ASSERT(isUsingStandardImpl<bool>()); + uUNIT_ASSERT(isUsingStandardImpl<unsigned short int>()); + uUNIT_ASSERT(isUsingStandardImpl<short int>()); + uUNIT_ASSERT(isUsingStandardImpl<unsigned int>()); + uUNIT_ASSERT(isUsingStandardImpl<int>()); + uUNIT_ASSERT(isUsingStandardImpl<unsigned long int>()); + uUNIT_ASSERT(isUsingStandardImpl<long int>()); + uUNIT_ASSERT(isUsingStandardImpl<unsigned long long int>()); + uUNIT_ASSERT(isUsingStandardImpl<long long int>()); + uUNIT_ASSERT(isUsingStandardImpl<float>()); + uUNIT_ASSERT(isUsingStandardImpl<double>()); + uUNIT_ASSERT(isUsingStandardImpl<long double>()); } void nonPodAtomicsUseOwnImpl() { - DGUNIT_ASSERT(!isUsingStandardImpl<std::string>()); + uUNIT_ASSERT(!isUsingStandardImpl<std::string>()); } void podAtomicCanBeDefaultInitialized() @@ -76,52 +76,52 @@ public: void nonPodAtomicCanBeDefaultInitialized() { Atomic<std::string> s; - DGUNIT_ASSERT_EQUAL(s.load(), std::string{}); + uUNIT_ASSERT_EQUAL(s.load(), std::string{}); } void podAtomicCanBeValueInitialized() { Atomic<int> i{5}; - DGUNIT_ASSERT_EQUAL(i.load(), 5); + uUNIT_ASSERT_EQUAL(i.load(), 5); } void nonPodAtomicCanBeValueInitialized() { Atomic<std::string> s{"hello world"}; - DGUNIT_ASSERT_EQUAL(s.load(), std::string{"hello world"}); + uUNIT_ASSERT_EQUAL(s.load(), std::string{"hello world"}); } void podAtomicCanBeValueAssigned() { Atomic<int> i; i = 5; - DGUNIT_ASSERT_EQUAL(i.load(), 5); + uUNIT_ASSERT_EQUAL(i.load(), 5); } void nonPodAtomicCanBeValueAssigned() { Atomic<std::string> s; s = "hello world"; - DGUNIT_ASSERT_EQUAL(s.load(), std::string{"hello world"}); + uUNIT_ASSERT_EQUAL(s.load(), std::string{"hello world"}); } void podAtomicsAreLockFree() { - DGUNIT_ASSERT(isLockFree<bool>()); - DGUNIT_ASSERT(isLockFree<unsigned short int>()); - DGUNIT_ASSERT(isLockFree<short int>()); - DGUNIT_ASSERT(isLockFree<unsigned int>()); - DGUNIT_ASSERT(isLockFree<int>()); - DGUNIT_ASSERT(isLockFree<unsigned long int>()); - DGUNIT_ASSERT(isLockFree<long int>()); - DGUNIT_ASSERT(isLockFree<float>()); - DGUNIT_ASSERT(isLockFree<std::size_t>()); + uUNIT_ASSERT(isLockFree<bool>()); + uUNIT_ASSERT(isLockFree<unsigned short int>()); + uUNIT_ASSERT(isLockFree<short int>()); + uUNIT_ASSERT(isLockFree<unsigned int>()); + uUNIT_ASSERT(isLockFree<int>()); + uUNIT_ASSERT(isLockFree<unsigned long int>()); + uUNIT_ASSERT(isLockFree<long int>()); + uUNIT_ASSERT(isLockFree<float>()); + uUNIT_ASSERT(isLockFree<std::size_t>()); // NOTE: Not lock free on small systems - //DGUNIT_ASSERT(isLockFree<unsigned long long int>()); - //DGUNIT_ASSERT(isLockFree<long long int>()); - //DGUNIT_ASSERT(isLockFree<double>()); - //DGUNIT_ASSERT(isLockFree<long double>()); + //uUNIT_ASSERT(isLockFree<unsigned long long int>()); + //uUNIT_ASSERT(isLockFree<long long int>()); + //uUNIT_ASSERT(isLockFree<double>()); + //uUNIT_ASSERT(isLockFree<long double>()); } private: diff --git a/test/audiocacheeventhandlertest.cc b/test/audiocacheeventhandlertest.cc index a2639fb..441c73e 100644 --- a/test/audiocacheeventhandlertest.cc +++ b/test/audiocacheeventhandlertest.cc @@ -24,17 +24,17 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <audiocacheeventhandler.h> class AudioCacheEventHandlerTest - : public DGUnit + : public uUnit { public: AudioCacheEventHandlerTest() { - DGUNIT_TEST(AudioCacheEventHandlerTest::threadedTest); + uUNIT_TEST(AudioCacheEventHandlerTest::threadedTest); } public: diff --git a/test/audiocachefiletest.cc b/test/audiocachefiletest.cc index f1473de..437bb2f 100644 --- a/test/audiocachefiletest.cc +++ b/test/audiocachefiletest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <cstring> @@ -53,14 +53,14 @@ public: }; class AudioCacheFileTest - : public DGUnit + : public uUnit { public: AudioCacheFileTest() { - DGUNIT_TEST(AudioCacheFileTest::refTest); - DGUNIT_TEST(AudioCacheFileTest::readTest); - DGUNIT_TEST(AudioCacheFileTest::noFileTest); + uUNIT_TEST(AudioCacheFileTest::refTest); + uUNIT_TEST(AudioCacheFileTest::readTest); + uUNIT_TEST(AudioCacheFileTest::noFileTest); } DrumkitCreator drumkit_creator; @@ -72,19 +72,19 @@ public: // Conduct tests TestableAudioCacheFiles audiofiles; - DGUNIT_ASSERT_EQUAL(-1, audiofiles.getRef(filename)); + uUNIT_ASSERT_EQUAL(-1, audiofiles.getRef(filename)); audiofiles.getFile(filename); - DGUNIT_ASSERT_EQUAL(1, audiofiles.getRef(filename)); + uUNIT_ASSERT_EQUAL(1, audiofiles.getRef(filename)); audiofiles.getFile(filename); - DGUNIT_ASSERT_EQUAL(2, audiofiles.getRef(filename)); + uUNIT_ASSERT_EQUAL(2, audiofiles.getRef(filename)); audiofiles.releaseFile(filename); - DGUNIT_ASSERT_EQUAL(1, audiofiles.getRef(filename)); + uUNIT_ASSERT_EQUAL(1, audiofiles.getRef(filename)); audiofiles.releaseFile(filename); - DGUNIT_ASSERT_EQUAL(-1, audiofiles.getRef(filename)); + uUNIT_ASSERT_EQUAL(-1, audiofiles.getRef(filename)); } void readTestHelper(size_t buffer_size) @@ -105,8 +105,8 @@ public: std::vector<sample_t> read_buffer; AudioCacheFile file(filename, read_buffer); - DGUNIT_ASSERT_EQUAL(filename, file.getFilename()); - DGUNIT_ASSERT_EQUAL(13, (int)file.getChannelCount()); // Sanity check + uUNIT_ASSERT_EQUAL(filename, file.getFilename()); + uUNIT_ASSERT_EQUAL(13, (int)file.getChannelCount()); // Sanity check CacheChannels channels; @@ -150,7 +150,7 @@ public: for(size_t c = 0; c < 13; ++c) { - DGUNIT_ASSERT_EQUAL(true, ready[c]?true:false); + uUNIT_ASSERT_EQUAL(true, ready[c]?true:false); } sample_t diff[13] = {0.0}; @@ -164,7 +164,7 @@ public: for(int c = 0; c < 13; ++c) { - DGUNIT_ASSERT_EQUAL((sample_t)0.0, diff[c]); + uUNIT_ASSERT_EQUAL((sample_t)0.0, diff[c]); } } @@ -203,9 +203,9 @@ public: std::vector<sample_t> read_buffer; AudioCacheFile file(filename, read_buffer); - DGUNIT_ASSERT_EQUAL(filename, file.getFilename()); - DGUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getSize()); - DGUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getChannelCount()); + uUNIT_ASSERT_EQUAL(filename, file.getFilename()); + uUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getSize()); + uUNIT_ASSERT_EQUAL(0u, (unsigned int)file.getChannelCount()); CacheChannels channels; @@ -237,14 +237,14 @@ public: for(size_t c = 0; c < 13; ++c) { - DGUNIT_ASSERT_EQUAL(false, ready[c]?true:false); + uUNIT_ASSERT_EQUAL(false, ready[c]?true:false); } for(size_t c = 0; c < 13; ++c) { for(size_t i = 0; i < buffer_size; ++i) { - DGUNIT_ASSERT_EQUAL(42.0f, samples[c][i]); + uUNIT_ASSERT_EQUAL(42.0f, samples[c][i]); } } } diff --git a/test/audiocacheidmanagertest.cc b/test/audiocacheidmanagertest.cc index 75a7c51..c84926b 100644 --- a/test/audiocacheidmanagertest.cc +++ b/test/audiocacheidmanagertest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <audiocacheidmanager.h> @@ -39,12 +39,12 @@ public: }; class AudioCacheIDManagerTest - : public DGUnit + : public uUnit { public: AudioCacheIDManagerTest() { - DGUNIT_TEST(AudioCacheIDManagerTest::registerReleaseTest); + uUNIT_TEST(AudioCacheIDManagerTest::registerReleaseTest); } void registerReleaseTest() @@ -54,44 +54,44 @@ public: cache_t c1; c1.afile = (AudioCacheFile*)1; auto id1 = manager.registerID(c1); - DGUNIT_ASSERT(id1 != CACHE_DUMMYID); - DGUNIT_ASSERT(id1 != CACHE_NOID); - DGUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); + uUNIT_ASSERT(id1 != CACHE_DUMMYID); + uUNIT_ASSERT(id1 != CACHE_NOID); + uUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); cache_t c2; c2.afile = (AudioCacheFile*)2; auto id2 = manager.registerID(c2); - DGUNIT_ASSERT(id2 != CACHE_DUMMYID); - DGUNIT_ASSERT(id2 != CACHE_NOID); - DGUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); + uUNIT_ASSERT(id2 != CACHE_DUMMYID); + uUNIT_ASSERT(id2 != CACHE_NOID); + uUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); cache_t c3; c3.afile = (AudioCacheFile*)3; auto id3 = manager.registerID(c3); - DGUNIT_ASSERT(id3 == CACHE_DUMMYID); - DGUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); + uUNIT_ASSERT(id3 == CACHE_DUMMYID); + uUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); cache_t& tc1 = manager.getCache(id1); - DGUNIT_ASSERT_EQUAL(c1.afile, tc1.afile); + uUNIT_ASSERT_EQUAL(c1.afile, tc1.afile); cache_t& tc2 = manager.getCache(id2); - DGUNIT_ASSERT_EQUAL(c2.afile, tc2.afile); + uUNIT_ASSERT_EQUAL(c2.afile, tc2.afile); manager.releaseID(id1); - DGUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); + uUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); cache_t c4; c4.afile = (AudioCacheFile*)4; auto id4 = manager.registerID(c4); - DGUNIT_ASSERT(id4 != CACHE_DUMMYID); - DGUNIT_ASSERT(id4 != CACHE_NOID); - DGUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); + uUNIT_ASSERT(id4 != CACHE_DUMMYID); + uUNIT_ASSERT(id4 != CACHE_NOID); + uUNIT_ASSERT_EQUAL(0, manager.getAvailableIDs()); cache_t& tc4 = manager.getCache(id4); - DGUNIT_ASSERT_EQUAL(c4.afile, tc4.afile); + uUNIT_ASSERT_EQUAL(c4.afile, tc4.afile); manager.releaseID(id2); - DGUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); + uUNIT_ASSERT_EQUAL(1, manager.getAvailableIDs()); manager.releaseID(id4); - DGUNIT_ASSERT_EQUAL(2, manager.getAvailableIDs()); + uUNIT_ASSERT_EQUAL(2, manager.getAvailableIDs()); } }; diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc index 74c7df4..823e9c4 100644 --- a/test/audiocachetest.cc +++ b/test/audiocachetest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <thread> #include <chrono> @@ -38,15 +38,15 @@ #define FRAMESIZE 64 class AudioCacheTest - : public DGUnit + : public uUnit { public: AudioCacheTest() { - DGUNIT_TEST(AudioCacheTest::singleChannelNonThreaded); - DGUNIT_TEST(AudioCacheTest::singleChannelThreaded); - DGUNIT_TEST(AudioCacheTest::multiChannelNonThreaded); - DGUNIT_TEST(AudioCacheTest::multiChannelThreaded); + uUNIT_TEST(AudioCacheTest::singleChannelNonThreaded); + uUNIT_TEST(AudioCacheTest::singleChannelThreaded); + uUNIT_TEST(AudioCacheTest::multiChannelNonThreaded); + uUNIT_TEST(AudioCacheTest::multiChannelThreaded); } DrumkitCreator drumkit_creator; @@ -95,7 +95,7 @@ public: // Test pre cache: for(size_t i = 0; i < size; ++i) { - DGUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); + uUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); ++offset; } @@ -111,7 +111,7 @@ public: std::this_thread::sleep_for(std::chrono::milliseconds(1)); if(--timeout == 0) { - DGUNIT_ASSERT(false); // timeout + uUNIT_ASSERT(false); // timeout } } } @@ -119,7 +119,7 @@ public: size = framesize; samples = audio_cache.next(id, size); - DGUNIT_ASSERT_EQUAL(std::size_t(0), settings.number_of_underruns.load()); + uUNIT_ASSERT_EQUAL(std::size_t(0), settings.number_of_underruns.load()); for(size_t i = 0; (i < size) && (offset < audio_file_ref.size); ++i) { @@ -131,7 +131,7 @@ public: (int)(audio_file_ref.size - offset), (int)i, (int)size, (int)(size - i)); } - DGUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); + uUNIT_ASSERT_EQUAL(audio_file_ref.data[offset], samples[i]); ++offset; } } diff --git a/test/bytesizeparsertest.cc b/test/bytesizeparsertest.cc index ea082e2..58ea5d5 100644 --- a/test/bytesizeparsertest.cc +++ b/test/bytesizeparsertest.cc @@ -24,21 +24,21 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "bytesizeparser.h" class ByteSizeParserTest - : public DGUnit + : public uUnit { public: ByteSizeParserTest() { - DGUNIT_TEST(ByteSizeParserTest::suffixTest); - DGUNIT_TEST(ByteSizeParserTest::falseSuffixTest); - DGUNIT_TEST(ByteSizeParserTest::falseNumberTest); - DGUNIT_TEST(ByteSizeParserTest::tooBigNumberTest); + uUNIT_TEST(ByteSizeParserTest::suffixTest); + uUNIT_TEST(ByteSizeParserTest::falseSuffixTest); + uUNIT_TEST(ByteSizeParserTest::falseNumberTest); + uUNIT_TEST(ByteSizeParserTest::tooBigNumberTest); } void suffixTest() @@ -47,76 +47,76 @@ public: std::size_t kilo = 1024, mega = kilo * 1024, giga = mega * 1024; computed_size = byteSizeParser("3"); expected_size = 3; - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3k"); expected_size = 3 * kilo; - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3M"); expected_size = 3 * mega; - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3G"); expected_size = 3 * giga; - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); } void falseSuffixTest() { std::size_t computed_size, expected_size = 0; computed_size = byteSizeParser("3K"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3m"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3g"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3ddDD"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); } void falseNumberTest() { std::size_t computed_size, expected_size = 0; computed_size = byteSizeParser("K3k"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("-3"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("-3k"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("-3M"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("-3G"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3-"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3-k"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("k-3"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser("3-1"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); computed_size = byteSizeParser(" -3"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); } void tooBigNumberTest() { std::size_t computed_size, expected_size = 0; computed_size = byteSizeParser("999999999999999999999999999999999999G"); - DGUNIT_ASSERT_EQUAL(expected_size, computed_size); + uUNIT_ASSERT_EQUAL(expected_size, computed_size); } }; diff --git a/test/configparsertest.cc b/test/configparsertest.cc index 0b00d0c..69fa89a 100644 --- a/test/configparsertest.cc +++ b/test/configparsertest.cc @@ -24,18 +24,18 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <configparser.h> class ConfigParserTest - : public DGUnit + : public uUnit { public: ConfigParserTest() { - DGUNIT_TEST(ConfigParserTest::test); - DGUNIT_TEST(ConfigParserTest::invalid); + uUNIT_TEST(ConfigParserTest::test); + uUNIT_TEST(ConfigParserTest::invalid); } void test() @@ -50,14 +50,14 @@ public: ConfigParser parser; - DGUNIT_ASSERT(parser.parseString(xml)); + uUNIT_ASSERT(parser.parseString(xml)); - DGUNIT_ASSERT_EQUAL(std::string("42"), parser.value("foo", "-")); - DGUNIT_ASSERT_EQUAL(std::string("true"), parser.value("bar", "-")); - DGUNIT_ASSERT_EQUAL(std::string("\"<"), parser.value("bas", "-")); + uUNIT_ASSERT_EQUAL(std::string("42"), parser.value("foo", "-")); + uUNIT_ASSERT_EQUAL(std::string("true"), parser.value("bar", "-")); + uUNIT_ASSERT_EQUAL(std::string("\"<"), parser.value("bas", "-")); // Non-existing value - DGUNIT_ASSERT_EQUAL(std::string("-"), parser.value("bas2", "-")); + uUNIT_ASSERT_EQUAL(std::string("-"), parser.value("bas2", "-")); } void invalid() @@ -73,7 +73,7 @@ public: ConfigParser parser; // Epxect parser error (missing '>' in line 2) - DGUNIT_ASSERT(!parser.parseString(xml)); + uUNIT_ASSERT(!parser.parseString(xml)); } }; diff --git a/test/configtest.cc b/test/configtest.cc index 953c899..75a7b8d 100644 --- a/test/configtest.cc +++ b/test/configtest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <unistd.h> #include <stdio.h> @@ -49,27 +49,27 @@ protected: }; class test_configtest - : public DGUnit + : public uUnit { public: test_configtest() { - DGUNIT_TEST(test_configtest::loading_no_newline); - DGUNIT_TEST(test_configtest::loading_equal_sign); - DGUNIT_TEST(test_configtest::loading_newline); - DGUNIT_TEST(test_configtest::loading_padding_space); - DGUNIT_TEST(test_configtest::loading_padding_space_newline); - DGUNIT_TEST(test_configtest::loading_padding_tab); - DGUNIT_TEST(test_configtest::loading_padding_tab_newline); - DGUNIT_TEST(test_configtest::loading_comment); - DGUNIT_TEST(test_configtest::loading_inline_comment); - DGUNIT_TEST(test_configtest::loading_single_quoted_string); - DGUNIT_TEST(test_configtest::loading_double_quoted_string); - DGUNIT_TEST(test_configtest::loading_error_no_key); - DGUNIT_TEST(test_configtest::loading_error_no_value); - DGUNIT_TEST(test_configtest::loading_error_string_not_terminated_single); - DGUNIT_TEST(test_configtest::loading_error_string_not_terminated_double); - DGUNIT_TEST(test_configtest::empty_value); + uUNIT_TEST(test_configtest::loading_no_newline); + uUNIT_TEST(test_configtest::loading_equal_sign); + uUNIT_TEST(test_configtest::loading_newline); + uUNIT_TEST(test_configtest::loading_padding_space); + uUNIT_TEST(test_configtest::loading_padding_space_newline); + uUNIT_TEST(test_configtest::loading_padding_tab); + uUNIT_TEST(test_configtest::loading_padding_tab_newline); + uUNIT_TEST(test_configtest::loading_comment); + uUNIT_TEST(test_configtest::loading_inline_comment); + uUNIT_TEST(test_configtest::loading_single_quoted_string); + uUNIT_TEST(test_configtest::loading_double_quoted_string); + uUNIT_TEST(test_configtest::loading_error_no_key); + uUNIT_TEST(test_configtest::loading_error_no_value); + uUNIT_TEST(test_configtest::loading_error_string_not_terminated_single); + uUNIT_TEST(test_configtest::loading_error_string_not_terminated_double); + uUNIT_TEST(test_configtest::empty_value); } void teardown() override @@ -93,8 +93,8 @@ public: writeFile("a:b", false); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_equal_sign() @@ -102,8 +102,8 @@ public: writeFile(" a =\tb\t"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_newline() @@ -111,8 +111,8 @@ public: writeFile("a:b"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_padding_space() @@ -120,8 +120,8 @@ public: writeFile(" a : b ", false); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_padding_tab() @@ -129,8 +129,8 @@ public: writeFile("\ta\t:\tb\t", false); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_padding_space_newline() @@ -138,8 +138,8 @@ public: writeFile(" a : b "); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_padding_tab_newline() @@ -147,8 +147,8 @@ public: writeFile("\ta\t:\tb\t"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_comment() @@ -156,8 +156,8 @@ public: writeFile("# comment\na:b"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_inline_comment() @@ -165,8 +165,8 @@ public: writeFile("a:b #comment"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("b"), cf.getValue("a")); } void loading_single_quoted_string() @@ -174,8 +174,8 @@ public: writeFile("a: '#\"b\" ' "); TestConfigFile cf; - DGUNIT_ASSERT(cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("#\"b\" "), cf.getValue("a")); + uUNIT_ASSERT(cf.load()); + uUNIT_ASSERT_EQUAL(std::string("#\"b\" "), cf.getValue("a")); } void loading_double_quoted_string() @@ -183,8 +183,8 @@ public: writeFile("a: \"#'b' \" "); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string("#'b' "), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string("#'b' "), cf.getValue("a")); } void loading_error_no_key() @@ -192,7 +192,7 @@ public: writeFile(":foo"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(false, cf.load()); + uUNIT_ASSERT_EQUAL(false, cf.load()); } void loading_error_no_value() @@ -200,7 +200,7 @@ public: writeFile("key"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(false, cf.load()); + uUNIT_ASSERT_EQUAL(false, cf.load()); } void loading_error_string_not_terminated_single() @@ -208,7 +208,7 @@ public: writeFile("a:'b"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(false, cf.load()); + uUNIT_ASSERT_EQUAL(false, cf.load()); } void loading_error_string_not_terminated_double() @@ -216,7 +216,7 @@ public: writeFile("a:\"b"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(false, cf.load()); + uUNIT_ASSERT_EQUAL(false, cf.load()); } void empty_value() @@ -224,8 +224,8 @@ public: writeFile("a:"); TestConfigFile cf; - DGUNIT_ASSERT_EQUAL(true, cf.load()); - DGUNIT_ASSERT_EQUAL(std::string(""), cf.getValue("a")); + uUNIT_ASSERT_EQUAL(true, cf.load()); + uUNIT_ASSERT_EQUAL(std::string(""), cf.getValue("a")); } }; diff --git a/test/dgtest.cc b/test/dgtest.cc index 21e1543..3a5b466 100644 --- a/test/dgtest.cc +++ b/test/dgtest.cc @@ -24,8 +24,8 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define DGUNIT_MAIN -#include "dgunit.h" +#define uUNIT_MAIN +#include <uunit.h> #include <fstream> @@ -33,5 +33,5 @@ int main(int argc, char* argv[]) { std::ofstream xmlfile; xmlfile.open("result_" OUTPUT ".xml"); - return DGUnit::runTests(xmlfile); + return uUnit::runTests(xmlfile); } diff --git a/test/dgxmlparsertest.cc b/test/dgxmlparsertest.cc index a1f7bd3..f65fb6f 100644 --- a/test/dgxmlparsertest.cc +++ b/test/dgxmlparsertest.cc @@ -24,20 +24,20 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <dgxmlparser.h> #include "scopedfile.h" class DGXmlParserTest - : public DGUnit + : public uUnit { public: DGXmlParserTest() { - DGUNIT_TEST(DGXmlParserTest::instrumentParserTest_v1); - DGUNIT_TEST(DGXmlParserTest::instrumentParserTest_v2); - DGUNIT_TEST(DGXmlParserTest::drumkitParserTest); + uUNIT_TEST(DGXmlParserTest::instrumentParserTest_v1); + uUNIT_TEST(DGXmlParserTest::instrumentParserTest_v2); + uUNIT_TEST(DGXmlParserTest::drumkitParserTest); } void instrumentParserTest_v1() @@ -72,80 +72,80 @@ public: "</instrument>"); InstrumentDOM dom; - DGUNIT_ASSERT(probeInstrumentFile(scoped_file.filename())); - DGUNIT_ASSERT(parseInstrumentFile(scoped_file.filename(), dom)); + uUNIT_ASSERT(probeInstrumentFile(scoped_file.filename())); + uUNIT_ASSERT(parseInstrumentFile(scoped_file.filename(), dom)); - DGUNIT_ASSERT_EQUAL(std::string("Snare"), dom.name); - DGUNIT_ASSERT_EQUAL(std::string("1.0"), dom.version); - DGUNIT_ASSERT_EQUAL(std::string("A nice snare"), dom.description); - DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.samples.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare"), dom.name); + uUNIT_ASSERT_EQUAL(std::string("1.0"), dom.version); + uUNIT_ASSERT_EQUAL(std::string("A nice snare"), dom.description); + uUNIT_ASSERT_EQUAL(std::size_t(2), dom.samples.size()); { const auto& s = dom.samples[0]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), s.name); - DGUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), s.name); + uUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare-1.wav"), s.audiofiles[0].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare-1.wav"), s.audiofiles[0].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare-2.wav"), s.audiofiles[1].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[1].filechannel); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare-2.wav"), s.audiofiles[1].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[1].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare-3.wav"), s.audiofiles[2].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[2].filechannel); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare-3.wav"), s.audiofiles[2].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[2].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare-4.wav"), s.audiofiles[3].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[3].filechannel); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare-4.wav"), s.audiofiles[3].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[3].filechannel); } { const auto& s = dom.samples[1]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), s.name); - DGUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare-1.wav"), s.audiofiles[0].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare-2.wav"), s.audiofiles[1].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[1].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare-3.wav"), s.audiofiles[2].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[2].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare-4.wav"), s.audiofiles[3].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[3].filechannel); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), s.name); + uUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare-1.wav"), s.audiofiles[0].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare-2.wav"), s.audiofiles[1].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[1].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare-3.wav"), s.audiofiles[2].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[2].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare-4.wav"), s.audiofiles[3].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[3].filechannel); } - DGUNIT_ASSERT_EQUAL(std::size_t(0), dom.instrument_channels.size()); + uUNIT_ASSERT_EQUAL(std::size_t(0), dom.instrument_channels.size()); - DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.velocities.size()); + uUNIT_ASSERT_EQUAL(std::size_t(2), dom.velocities.size()); { const auto& velocity = dom.velocities[0]; - DGUNIT_ASSERT_EQUAL(0.0, velocity.lower); - DGUNIT_ASSERT_EQUAL(0.6, velocity.upper); - DGUNIT_ASSERT_EQUAL(std::size_t(2), velocity.samplerefs.size()); - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), velocity.samplerefs[0].name); - DGUNIT_ASSERT_EQUAL(0.6, velocity.samplerefs[0].probability); - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), velocity.samplerefs[1].name); - DGUNIT_ASSERT_EQUAL(0.4, velocity.samplerefs[1].probability); + uUNIT_ASSERT_EQUAL(0.0, velocity.lower); + uUNIT_ASSERT_EQUAL(0.6, velocity.upper); + uUNIT_ASSERT_EQUAL(std::size_t(2), velocity.samplerefs.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), velocity.samplerefs[0].name); + uUNIT_ASSERT_EQUAL(0.6, velocity.samplerefs[0].probability); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), velocity.samplerefs[1].name); + uUNIT_ASSERT_EQUAL(0.4, velocity.samplerefs[1].probability); } { const auto& velocity = dom.velocities[1]; - DGUNIT_ASSERT_EQUAL(0.6, velocity.lower); - DGUNIT_ASSERT_EQUAL(1.0, velocity.upper); - DGUNIT_ASSERT_EQUAL(std::size_t(2), velocity.samplerefs.size()); - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), velocity.samplerefs[0].name); - DGUNIT_ASSERT_EQUAL(0.4, velocity.samplerefs[0].probability); - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), velocity.samplerefs[1].name); - DGUNIT_ASSERT_EQUAL(0.6, velocity.samplerefs[1].probability); + uUNIT_ASSERT_EQUAL(0.6, velocity.lower); + uUNIT_ASSERT_EQUAL(1.0, velocity.upper); + uUNIT_ASSERT_EQUAL(std::size_t(2), velocity.samplerefs.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), velocity.samplerefs[0].name); + uUNIT_ASSERT_EQUAL(0.4, velocity.samplerefs[0].probability); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), velocity.samplerefs[1].name); + uUNIT_ASSERT_EQUAL(0.6, velocity.samplerefs[1].probability); } } @@ -176,68 +176,68 @@ public: "</instrument>"); InstrumentDOM dom; - DGUNIT_ASSERT(probeInstrumentFile(scoped_file.filename())); - DGUNIT_ASSERT(parseInstrumentFile(scoped_file.filename(), dom)); + uUNIT_ASSERT(probeInstrumentFile(scoped_file.filename())); + uUNIT_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()); + uUNIT_ASSERT_EQUAL(std::string("Snare"), dom.name); + uUNIT_ASSERT_EQUAL(std::string("2.0"), dom.version); + uUNIT_ASSERT_EQUAL(std::string("A nice snare"), dom.description); + uUNIT_ASSERT_EQUAL(std::size_t(2), dom.samples.size()); { const auto& s = dom.samples[0]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), s.name); - DGUNIT_ASSERT_EQUAL(0.00985718, s.power); - DGUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), s.name); + uUNIT_ASSERT_EQUAL(0.00985718, s.power); + uUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[0].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[0].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[1].file); - DGUNIT_ASSERT_EQUAL(std::size_t(2), s.audiofiles[1].filechannel); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[1].file); + uUNIT_ASSERT_EQUAL(std::size_t(2), s.audiofiles[1].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[2].file); - DGUNIT_ASSERT_EQUAL(std::size_t(12), s.audiofiles[2].filechannel); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[2].file); + uUNIT_ASSERT_EQUAL(std::size_t(12), s.audiofiles[2].filechannel); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[3].file); - DGUNIT_ASSERT_EQUAL(std::size_t(13), s.audiofiles[3].filechannel); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("1-Snare.wav"), s.audiofiles[3].file); + uUNIT_ASSERT_EQUAL(std::size_t(13), s.audiofiles[3].filechannel); } { const auto& s = dom.samples[1]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), s.name); - DGUNIT_ASSERT_EQUAL(0.0124808, s.power); - DGUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[0].file); - DGUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[1].file); - DGUNIT_ASSERT_EQUAL(std::size_t(2), s.audiofiles[1].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[2].file); - DGUNIT_ASSERT_EQUAL(std::size_t(12), s.audiofiles[2].filechannel); - - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); - DGUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[3].file); - DGUNIT_ASSERT_EQUAL(std::size_t(13), s.audiofiles[3].filechannel); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), s.name); + uUNIT_ASSERT_EQUAL(0.0124808, s.power); + uUNIT_ASSERT_EQUAL(std::size_t(4), s.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), s.audiofiles[0].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[0].file); + uUNIT_ASSERT_EQUAL(std::size_t(1), s.audiofiles[0].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), s.audiofiles[1].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[1].file); + uUNIT_ASSERT_EQUAL(std::size_t(2), s.audiofiles[1].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), s.audiofiles[2].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[2].file); + uUNIT_ASSERT_EQUAL(std::size_t(12), s.audiofiles[2].filechannel); + + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), s.audiofiles[3].instrument_channel); + uUNIT_ASSERT_EQUAL(std::string("2-Snare.wav"), s.audiofiles[3].file); + uUNIT_ASSERT_EQUAL(std::size_t(13), s.audiofiles[3].filechannel); } - DGUNIT_ASSERT_EQUAL(std::size_t(3), dom.instrument_channels.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), dom.instrument_channels[0].name); - DGUNIT_ASSERT(main_state_t::is_main == dom.instrument_channels[0].main); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), dom.instrument_channels[1].name); - DGUNIT_ASSERT(main_state_t::is_not_main == dom.instrument_channels[1].main); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), dom.instrument_channels[2].name); - DGUNIT_ASSERT(main_state_t::unset == dom.instrument_channels[2].main); + uUNIT_ASSERT_EQUAL(std::size_t(3), dom.instrument_channels.size()); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), dom.instrument_channels[0].name); + uUNIT_ASSERT(main_state_t::is_main == dom.instrument_channels[0].main); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), dom.instrument_channels[1].name); + uUNIT_ASSERT(main_state_t::is_not_main == dom.instrument_channels[1].main); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), dom.instrument_channels[2].name); + uUNIT_ASSERT(main_state_t::unset == dom.instrument_channels[2].main); - DGUNIT_ASSERT_EQUAL(std::size_t(0), dom.velocities.size()); + uUNIT_ASSERT_EQUAL(std::size_t(0), dom.velocities.size()); } void drumkitParserTest() @@ -283,81 +283,81 @@ public: "</drumkit>"); DrumkitDOM dom; - DGUNIT_ASSERT(probeDrumkitFile(scoped_file.filename())); - DGUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), dom)); - - DGUNIT_ASSERT_EQUAL(std::string("2.0"), dom.version); - DGUNIT_ASSERT_EQUAL(48000.0, dom.samplerate); - - DGUNIT_ASSERT_EQUAL(std::string("1.2.3"), dom.metadata.version); - DGUNIT_ASSERT_EQUAL(std::string("Test Kit"), dom.metadata.title); - DGUNIT_ASSERT_EQUAL(std::string("LogoFile.png"), dom.metadata.logo); - DGUNIT_ASSERT_EQUAL(std::string("This is the description of the drumkit"), dom.metadata.description); - DGUNIT_ASSERT_EQUAL(std::string("Creative Commons"), dom.metadata.license); - DGUNIT_ASSERT_EQUAL(std::string("These are general notes"), dom.metadata.notes); - DGUNIT_ASSERT_EQUAL(std::string("Author of the drumkit"), dom.metadata.author); - DGUNIT_ASSERT_EQUAL(std::string("author@email.org"), dom.metadata.email); - DGUNIT_ASSERT_EQUAL(std::string("http://www.drumgizmo.org"), dom.metadata.website); - DGUNIT_ASSERT_EQUAL(std::string("DrumkitImage.png"), dom.metadata.image); - DGUNIT_ASSERT_EQUAL(std::string("DrumkitImageClickMap.png"), dom.metadata.image_map); - - DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.metadata.clickmaps.size()); - DGUNIT_ASSERT_EQUAL(std::string("ff08a2"), dom.metadata.clickmaps[0].colour); - DGUNIT_ASSERT_EQUAL(std::string("China"), dom.metadata.clickmaps[0].instrument); - DGUNIT_ASSERT_EQUAL(std::string("a218d7"), dom.metadata.clickmaps[1].colour); - DGUNIT_ASSERT_EQUAL(std::string("HihatClosed"), dom.metadata.clickmaps[1].instrument); - - DGUNIT_ASSERT_EQUAL(std::size_t(2), dom.instruments.size()); + uUNIT_ASSERT(probeDrumkitFile(scoped_file.filename())); + uUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), dom)); + + uUNIT_ASSERT_EQUAL(std::string("2.0"), dom.version); + uUNIT_ASSERT_EQUAL(48000.0, dom.samplerate); + + uUNIT_ASSERT_EQUAL(std::string("1.2.3"), dom.metadata.version); + uUNIT_ASSERT_EQUAL(std::string("Test Kit"), dom.metadata.title); + uUNIT_ASSERT_EQUAL(std::string("LogoFile.png"), dom.metadata.logo); + uUNIT_ASSERT_EQUAL(std::string("This is the description of the drumkit"), dom.metadata.description); + uUNIT_ASSERT_EQUAL(std::string("Creative Commons"), dom.metadata.license); + uUNIT_ASSERT_EQUAL(std::string("These are general notes"), dom.metadata.notes); + uUNIT_ASSERT_EQUAL(std::string("Author of the drumkit"), dom.metadata.author); + uUNIT_ASSERT_EQUAL(std::string("author@email.org"), dom.metadata.email); + uUNIT_ASSERT_EQUAL(std::string("http://www.drumgizmo.org"), dom.metadata.website); + uUNIT_ASSERT_EQUAL(std::string("DrumkitImage.png"), dom.metadata.image); + uUNIT_ASSERT_EQUAL(std::string("DrumkitImageClickMap.png"), dom.metadata.image_map); + + uUNIT_ASSERT_EQUAL(std::size_t(2), dom.metadata.clickmaps.size()); + uUNIT_ASSERT_EQUAL(std::string("ff08a2"), dom.metadata.clickmaps[0].colour); + uUNIT_ASSERT_EQUAL(std::string("China"), dom.metadata.clickmaps[0].instrument); + uUNIT_ASSERT_EQUAL(std::string("a218d7"), dom.metadata.clickmaps[1].colour); + uUNIT_ASSERT_EQUAL(std::string("HihatClosed"), dom.metadata.clickmaps[1].instrument); + + uUNIT_ASSERT_EQUAL(std::size_t(2), dom.instruments.size()); { const auto& instr = dom.instruments[0]; - DGUNIT_ASSERT_EQUAL(std::string("Snare1"), instr.name); - DGUNIT_ASSERT_EQUAL(std::string("foo.wav"), instr.file); - DGUNIT_ASSERT_EQUAL(std::string("somegroup"), instr.group); - DGUNIT_ASSERT_EQUAL(std::size_t(4), instr.channel_map.size()); - - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft-in"), instr.channel_map[0].in); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight-in"), instr.channel_map[1].in); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop-in"), instr.channel_map[2].in); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom-in"), instr.channel_map[3].in); - - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), instr.channel_map[0].out); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), instr.channel_map[1].out); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), instr.channel_map[2].out); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), instr.channel_map[3].out); - - DGUNIT_ASSERT(main_state_t::is_main == instr.channel_map[0].main); - DGUNIT_ASSERT(main_state_t::is_main == instr.channel_map[1].main); - DGUNIT_ASSERT(main_state_t::unset == instr.channel_map[2].main); - DGUNIT_ASSERT(main_state_t::unset == instr.channel_map[3].main); + uUNIT_ASSERT_EQUAL(std::string("Snare1"), instr.name); + uUNIT_ASSERT_EQUAL(std::string("foo.wav"), instr.file); + uUNIT_ASSERT_EQUAL(std::string("somegroup"), instr.group); + uUNIT_ASSERT_EQUAL(std::size_t(4), instr.channel_map.size()); + + uUNIT_ASSERT_EQUAL(std::string("AmbLeft-in"), instr.channel_map[0].in); + uUNIT_ASSERT_EQUAL(std::string("AmbRight-in"), instr.channel_map[1].in); + uUNIT_ASSERT_EQUAL(std::string("SnareTop-in"), instr.channel_map[2].in); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom-in"), instr.channel_map[3].in); + + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), instr.channel_map[0].out); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), instr.channel_map[1].out); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), instr.channel_map[2].out); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), instr.channel_map[3].out); + + uUNIT_ASSERT(main_state_t::is_main == instr.channel_map[0].main); + uUNIT_ASSERT(main_state_t::is_main == instr.channel_map[1].main); + uUNIT_ASSERT(main_state_t::unset == instr.channel_map[2].main); + uUNIT_ASSERT(main_state_t::unset == instr.channel_map[3].main); } { const auto& instr = dom.instruments[1]; - DGUNIT_ASSERT_EQUAL(std::string("Snare2"), instr.name); - DGUNIT_ASSERT_EQUAL(std::string("bar.wav"), instr.file); - DGUNIT_ASSERT_EQUAL(std::string(""), instr.group); - DGUNIT_ASSERT_EQUAL(std::size_t(4), instr.channel_map.size()); - - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft2-in"), instr.channel_map[0].in); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight2-in"), instr.channel_map[1].in); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop2-in"), instr.channel_map[2].in); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom2-in"), instr.channel_map[3].in); - - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), instr.channel_map[0].out); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), instr.channel_map[1].out); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), instr.channel_map[2].out); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), instr.channel_map[3].out); - - DGUNIT_ASSERT(main_state_t::is_not_main == instr.channel_map[0].main); - DGUNIT_ASSERT(main_state_t::is_not_main == instr.channel_map[1].main); - DGUNIT_ASSERT(main_state_t::unset == instr.channel_map[2].main); - DGUNIT_ASSERT(main_state_t::unset == instr.channel_map[3].main); + uUNIT_ASSERT_EQUAL(std::string("Snare2"), instr.name); + uUNIT_ASSERT_EQUAL(std::string("bar.wav"), instr.file); + uUNIT_ASSERT_EQUAL(std::string(""), instr.group); + uUNIT_ASSERT_EQUAL(std::size_t(4), instr.channel_map.size()); + + uUNIT_ASSERT_EQUAL(std::string("AmbLeft2-in"), instr.channel_map[0].in); + uUNIT_ASSERT_EQUAL(std::string("AmbRight2-in"), instr.channel_map[1].in); + uUNIT_ASSERT_EQUAL(std::string("SnareTop2-in"), instr.channel_map[2].in); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom2-in"), instr.channel_map[3].in); + + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), instr.channel_map[0].out); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), instr.channel_map[1].out); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), instr.channel_map[2].out); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), instr.channel_map[3].out); + + uUNIT_ASSERT(main_state_t::is_not_main == instr.channel_map[0].main); + uUNIT_ASSERT(main_state_t::is_not_main == instr.channel_map[1].main); + uUNIT_ASSERT(main_state_t::unset == instr.channel_map[2].main); + uUNIT_ASSERT(main_state_t::unset == instr.channel_map[3].main); } - DGUNIT_ASSERT_EQUAL(std::size_t(4), dom.channels.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), dom.channels[0].name); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), dom.channels[1].name); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), dom.channels[2].name); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), dom.channels[3].name); + uUNIT_ASSERT_EQUAL(std::size_t(4), dom.channels.size()); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), dom.channels[0].name); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), dom.channels[1].name); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), dom.channels[2].name); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), dom.channels[3].name); } }; diff --git a/test/domloadertest.cc b/test/domloadertest.cc index 093bcde..d8bc4fa 100644 --- a/test/domloadertest.cc +++ b/test/domloadertest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <DGDOM.h> #include <domloader.h> @@ -37,12 +37,12 @@ #include "path.h" class DOMLoaderTest - : public DGUnit + : public uUnit { public: DOMLoaderTest() { - DGUNIT_TEST(DOMLoaderTest::testTest); + uUNIT_TEST(DOMLoaderTest::testTest); } Settings settings; @@ -130,75 +130,75 @@ public: DrumkitDOM drumkitdom; std::vector<InstrumentDOM> instrumentdoms; - DGUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), drumkitdom)); + uUNIT_ASSERT(parseDrumkitFile(scoped_file.filename(), drumkitdom)); auto basepath = getPath(scoped_file.filename()); for(const auto& ref: drumkitdom.instruments) { instrumentdoms.emplace_back(); - DGUNIT_ASSERT(parseInstrumentFile(basepath + "/" + ref.file, instrumentdoms.back())); + uUNIT_ASSERT(parseInstrumentFile(basepath + "/" + ref.file, instrumentdoms.back())); } DOMLoader domloader(settings, random); - DGUNIT_ASSERT(domloader.loadDom(basepath, drumkitdom, instrumentdoms, drumkit)); + uUNIT_ASSERT(domloader.loadDom(basepath, drumkitdom, instrumentdoms, drumkit)); // // Drumkit: // - DGUNIT_ASSERT_EQUAL(std::size_t(2), drumkit.instruments.size()); - DGUNIT_ASSERT_EQUAL(std::size_t(4), drumkit.channels.size()); + uUNIT_ASSERT_EQUAL(std::size_t(2), drumkit.instruments.size()); + uUNIT_ASSERT_EQUAL(std::size_t(4), drumkit.channels.size()); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), drumkit.channels[0].name); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), drumkit.channels[1].name); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), drumkit.channels[2].name); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), drumkit.channels[3].name); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), drumkit.channels[0].name); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), drumkit.channels[1].name); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), drumkit.channels[2].name); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), drumkit.channels[3].name); - DGUNIT_ASSERT_EQUAL(48000.0f, drumkit.metadata._samplerate); + uUNIT_ASSERT_EQUAL(48000.0f, drumkit.metadata._samplerate); - DGUNIT_ASSERT(VersionStr("2.0.0") == drumkit.metadata._version); + uUNIT_ASSERT(VersionStr("2.0.0") == drumkit.metadata._version); // // Instrument1 'Snare1': // { auto& instrument = *drumkit.instruments[0]; - DGUNIT_ASSERT_EQUAL(std::string(""), instrument._group); - DGUNIT_ASSERT_EQUAL(std::string("Snare1"), instrument._name); - DGUNIT_ASSERT_EQUAL(std::string(""), instrument._description); + uUNIT_ASSERT_EQUAL(std::string(""), instrument._group); + uUNIT_ASSERT_EQUAL(std::string("Snare1"), instrument._name); + uUNIT_ASSERT_EQUAL(std::string(""), instrument._description); - DGUNIT_ASSERT(VersionStr("2.0.0") == instrument.version); + uUNIT_ASSERT(VersionStr("2.0.0") == instrument.version); // NOTE: instrument.samples are the sample map belonging to version 1.0 - DGUNIT_ASSERT_EQUAL(std::size_t(2), instrument.samplelist.size()); + uUNIT_ASSERT_EQUAL(std::size_t(2), instrument.samplelist.size()); { const auto& sample = *instrument.samplelist[0]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), sample.name); - DGUNIT_ASSERT_EQUAL(0.00985718f, sample.power); - DGUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), sample.name); + uUNIT_ASSERT_EQUAL(0.00985718f, sample.power); + uUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); for(const auto& audiofile : sample.audiofiles) { - DGUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare.wav"), audiofile.second->filename); + uUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare.wav"), audiofile.second->filename); switch(audiofile.second->filechannel) { // NOTE: Channel numbers are zero based - they are 1 based in the xml case 0: - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), audiofile.second->instrument_channel->name); break; case 1: - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), audiofile.second->instrument_channel->name); break; case 11: - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), audiofile.second->instrument_channel->name); break; case 12: - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), audiofile.second->instrument_channel->name); break; default: - DGUNIT_ASSERT(false); + uUNIT_ASSERT(false); break; } } @@ -206,33 +206,33 @@ public: { const auto& sample = *instrument.samplelist[1]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), sample.name); - DGUNIT_ASSERT_EQUAL(0.0124808f, sample.power); - DGUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), sample.name); + uUNIT_ASSERT_EQUAL(0.0124808f, sample.power); + uUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); for(const auto& audiofile : sample.audiofiles) { - DGUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare.wav"), audiofile.second->filename); + uUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare.wav"), audiofile.second->filename); switch(audiofile.second->filechannel) { // NOTE: Channel numbers are zero based - they are 1 based in the xml case 0: - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), audiofile.second->instrument_channel->name); break; case 1: - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), audiofile.second->instrument_channel->name); break; case 11: - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), audiofile.second->instrument_channel->name); break; case 12: - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), audiofile.second->instrument_channel->name); break; default: - DGUNIT_ASSERT(false); + uUNIT_ASSERT(false); break; } } @@ -245,67 +245,67 @@ public: { auto& instrument = *drumkit.instruments[1]; - DGUNIT_ASSERT_EQUAL(std::string(""), instrument._group); - DGUNIT_ASSERT_EQUAL(std::string("Snare2"), instrument._name); - DGUNIT_ASSERT_EQUAL(std::string(""), instrument._description); + uUNIT_ASSERT_EQUAL(std::string(""), instrument._group); + uUNIT_ASSERT_EQUAL(std::string("Snare2"), instrument._name); + uUNIT_ASSERT_EQUAL(std::string(""), instrument._description); - DGUNIT_ASSERT(VersionStr("1.0.0") == instrument.version); + uUNIT_ASSERT(VersionStr("1.0.0") == instrument.version); // NOTE: instrument.samples are the sample map belonging to version 1.0 - DGUNIT_ASSERT_EQUAL(std::size_t(2), instrument.samplelist.size()); + uUNIT_ASSERT_EQUAL(std::size_t(2), instrument.samplelist.size()); { const auto& sample = *instrument.samplelist[0]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), sample.name); - DGUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), sample.name); + uUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); auto afile = sample.audiofiles.begin(); - DGUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-1.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-1.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-2.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-2.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-3.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-3.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-4.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/1-Snare-4.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), afile->second->instrument_channel->name); } { const auto& sample = *instrument.samplelist[1]; - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), sample.name); - DGUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), sample.name); + uUNIT_ASSERT_EQUAL(std::size_t(4), sample.audiofiles.size()); auto afile = sample.audiofiles.begin(); - DGUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-1.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("AmbLeft"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-1.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("AmbLeft"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-2.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("AmbRight"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-2.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("AmbRight"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-3.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("SnareBottom"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-3.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("SnareBottom"), afile->second->instrument_channel->name); ++afile; - DGUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-4.wav"), afile->second->filename); - DGUNIT_ASSERT_EQUAL(std::string("SnareTop"), afile->second->instrument_channel->name); + uUNIT_ASSERT_EQUAL(std::string("/tmp/2-Snare-4.wav"), afile->second->filename); + uUNIT_ASSERT_EQUAL(std::string("SnareTop"), afile->second->instrument_channel->name); } - DGUNIT_ASSERT_EQUAL(std::size_t(4), instrument.samples.values.size()); + uUNIT_ASSERT_EQUAL(std::size_t(4), instrument.samples.values.size()); auto value = instrument.samples.values.begin(); - DGUNIT_ASSERT_EQUAL(0.0, value->first.first); // lower - DGUNIT_ASSERT_EQUAL(0.6, value->first.second); // upper - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), value->second->name); + uUNIT_ASSERT_EQUAL(0.0, value->first.first); // lower + uUNIT_ASSERT_EQUAL(0.6, value->first.second); // upper + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), value->second->name); ++value; - DGUNIT_ASSERT_EQUAL(0.0, value->first.first); // lower - DGUNIT_ASSERT_EQUAL(0.6, value->first.second); // upper - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), value->second->name); + uUNIT_ASSERT_EQUAL(0.0, value->first.first); // lower + uUNIT_ASSERT_EQUAL(0.6, value->first.second); // upper + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), value->second->name); ++value; - DGUNIT_ASSERT_EQUAL(0.6, value->first.first); // lower - DGUNIT_ASSERT_EQUAL(1.0, value->first.second); // upper - DGUNIT_ASSERT_EQUAL(std::string("Snare-2"), value->second->name); + uUNIT_ASSERT_EQUAL(0.6, value->first.first); // lower + uUNIT_ASSERT_EQUAL(1.0, value->first.second); // upper + uUNIT_ASSERT_EQUAL(std::string("Snare-2"), value->second->name); ++value; - DGUNIT_ASSERT_EQUAL(0.6, value->first.first); // lower - DGUNIT_ASSERT_EQUAL(1.0, value->first.second); // upper - DGUNIT_ASSERT_EQUAL(std::string("Snare-1"), value->second->name); + uUNIT_ASSERT_EQUAL(0.6, value->first.first); // lower + uUNIT_ASSERT_EQUAL(1.0, value->first.second); // upper + uUNIT_ASSERT_EQUAL(std::string("Snare-1"), value->second->name); } } }; diff --git a/test/drumkitcreatortest.cc b/test/drumkitcreatortest.cc index bde58ef..7bfbc34 100644 --- a/test/drumkitcreatortest.cc +++ b/test/drumkitcreatortest.cc @@ -24,17 +24,17 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "drumkit_creator.h" class DrumkitcreatorTest - : public DGUnit + : public uUnit { public: DrumkitcreatorTest() { - DGUNIT_TEST(DrumkitcreatorTest::testTest); + uUNIT_TEST(DrumkitcreatorTest::testTest); } DrumkitCreator drumkit_creator; diff --git a/test/enginetest.cc b/test/enginetest.cc index 585b0d1..55c6464 100644 --- a/test/enginetest.cc +++ b/test/enginetest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <thread> #include <chrono> @@ -69,12 +69,12 @@ public: bool isFreewheeling() const override { return true; } }; -class test_engine : public DGUnit +class test_engine : public uUnit { public: test_engine() { - DGUNIT_TEST(test_engine::loading); + uUNIT_TEST(test_engine::loading); } DrumkitCreator drumkit_creator; diff --git a/test/eventsdstest.cc b/test/eventsdstest.cc index db6a662..3c0af68 100644 --- a/test/eventsdstest.cc +++ b/test/eventsdstest.cc @@ -24,17 +24,17 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "../src/events_ds.h" class EventsDSTest - : public DGUnit + : public uUnit { public: EventsDSTest() { - DGUNIT_TEST(EventsDSTest::test_all); + uUNIT_TEST(EventsDSTest::test_all); } public: @@ -48,27 +48,27 @@ public: events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "b", 42); events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "c", 42); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(13).empty()); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(13).empty()); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); auto group_id = events_ds.getSampleEventGroupIDsOf(42).back(); const auto& event_ids = events_ds.getEventIDsOf(group_id); - DGUNIT_ASSERT(event_ids.size() == 3); + uUNIT_ASSERT(event_ids.size() == 3); // group 2 events_ds.startAddingNewGroup(42); events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "d", 42); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); // group 3 events_ds.startAddingNewGroup(23); events_ds.emplace<SampleEvent>(7, 7, 1.0, nullptr, "foo", 23); events_ds.emplace<SampleEvent>(7, 7, 1.0, nullptr, "bar", 23); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); - DGUNIT_ASSERT(events_ds.numberOfEvents(13) == 4); - DGUNIT_ASSERT(events_ds.numberOfEvents(7) == 2); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); + uUNIT_ASSERT(events_ds.numberOfEvents(13) == 4); + uUNIT_ASSERT(events_ds.numberOfEvents(7) == 2); // iterate over std::string group_concat = ""; @@ -76,26 +76,26 @@ public: { group_concat.append(sample_event.group); } - DGUNIT_ASSERT(group_concat == "abcd"); + uUNIT_ASSERT(group_concat == "abcd"); // get and getType for (const auto& sample_event: events_ds.iterateOver<SampleEvent>(13)) { - DGUNIT_ASSERT(events_ds.get<SampleEvent>(sample_event.id).channel == 13); - DGUNIT_ASSERT(events_ds.getType(sample_event.id) == Event::Type::SampleEvent); + uUNIT_ASSERT(events_ds.get<SampleEvent>(sample_event.id).channel == 13); + uUNIT_ASSERT(events_ds.getType(sample_event.id) == Event::Type::SampleEvent); } // remove auto event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(42).back()).back(); events_ds.remove(event_id); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(23).back()).back(); events_ds.remove(event_id); - DGUNIT_ASSERT(!events_ds.getSampleEventGroupIDsOf(23).empty()); + uUNIT_ASSERT(!events_ds.getSampleEventGroupIDsOf(23).empty()); event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(23).back()).back(); events_ds.remove(event_id); - DGUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(23).empty()); + uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(23).empty()); } }; diff --git a/test/framesizetest.cc b/test/framesizetest.cc new file mode 100644 index 0000000..09b7b16 --- /dev/null +++ b/test/framesizetest.cc @@ -0,0 +1,26 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + * framesizetest.cc + * + * Thu Aug 2 12:16:27 CEST 2018 + * Copyright 2018 Bent Bisballe Nyeng + * deva@aasimon.org + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ diff --git a/test/imagecachetest.cc b/test/imagecachetest.cc index ea2c99d..5471afb 100644 --- a/test/imagecachetest.cc +++ b/test/imagecachetest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <cassert> @@ -49,46 +49,46 @@ public: }; class ImageCacheTest - : public DGUnit + : public uUnit { public: ImageCacheTest() { - DGUNIT_TEST(ImageCacheTest::refCountTest); + uUNIT_TEST(ImageCacheTest::refCountTest); } void refCountTest() { TestableImageCache imageCache; - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(0u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(0u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); { auto image1{imageCache.getImage("foo")}; (void)image1; - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(1u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); auto image2 = imageCache.getImage("bar"); - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(1u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); auto image3 = imageCache.getImage("foo"); - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(2u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(2u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); { auto image4 = imageCache.getImage("foo"); - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(3u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(3u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); } - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(2u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(2u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(1u)); } - DGUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(0u)); - DGUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); + uUNIT_ASSERT_EQUAL(imageCache.count("foo"), std::size_t(0u)); + uUNIT_ASSERT_EQUAL(imageCache.count("bar"), std::size_t(0u)); } }; diff --git a/test/lv2.cc b/test/lv2.cc index 0c86ad2..837117e 100644 --- a/test/lv2.cc +++ b/test/lv2.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <config.h> @@ -56,15 +56,15 @@ enum class Ports { * - Run with buffer size a prime number (and thereby not power of 2) * - Run with HUGE number of midi events in one buffer (10000) */ -class test_lv2 : public DGUnit +class test_lv2 : public uUnit { public: test_lv2() { - DGUNIT_TEST(test_lv2::open_and_verify); - DGUNIT_TEST(test_lv2::run_no_ports_connected); - DGUNIT_TEST(test_lv2::run_no_output_ports_connected); - DGUNIT_TEST(test_lv2::test1); + uUNIT_TEST(test_lv2::open_and_verify); + uUNIT_TEST(test_lv2::run_no_ports_connected); + uUNIT_TEST(test_lv2::run_no_output_ports_connected); + uUNIT_TEST(test_lv2::test1); } DrumkitCreator drumkit_creator; @@ -76,13 +76,13 @@ public: LV2TestHost h(LV2_PATH); res = h.open(DG_URI); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.verify(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.close(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); } void run_no_ports_connected() @@ -92,13 +92,13 @@ public: LV2TestHost h(LV2_PATH); res = h.open(DG_URI); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.verify(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.createInstance(44100); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); const char config_fmt[] = "<config>\n" @@ -167,21 +167,21 @@ public: latency_regain); res = h.loadConfig(config, strlen(config)); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); // run for 1 samples to trigger kit loading res = h.run(1); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); std::this_thread::sleep_for(std::chrono::milliseconds(1)); // wait for kit to get loaded (async), res = h.run(100); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.destroyInstance(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.close(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); } void run_no_output_ports_connected() @@ -191,13 +191,13 @@ public: LV2TestHost h(LV2_PATH); res = h.open(DG_URI); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.verify(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.createInstance(44100); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); const char config_fmt[] = "<config>\n" @@ -266,7 +266,7 @@ public: latency_regain); res = h.loadConfig(config, strlen(config)); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); // Port buffers: char sequence_buffer[4096]; @@ -277,22 +277,22 @@ public: LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer)); res = h.connectPort((int)Ports::MidiPort, seq.data()); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); // run for 1 samples to trigger kit loading res = h.run(1); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); std::this_thread::sleep_for(std::chrono::milliseconds(1)); // wait for kit to get loaded (async), seq.addMidiNote(5, 1, 127); res = h.run(100); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.destroyInstance(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.close(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); } void test1() @@ -302,13 +302,13 @@ public: LV2TestHost h(LV2_PATH); res = h.open(DG_URI); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.verify(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.createInstance(44100); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); const char config_fmt[] = "<config>\n" @@ -377,7 +377,7 @@ public: latency_regain); res = h.loadConfig(config, strlen(config)); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); // Port buffers: char sequence_buffer[4096]; @@ -389,7 +389,7 @@ public: LV2TestHost::Sequence seq(sequence_buffer, sizeof(sequence_buffer)); res = h.connectPort((int)Ports::MidiPort, seq.data()); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); for(int i = 0; i < NUM_CHANNELS; ++i) { @@ -399,11 +399,11 @@ public: } res += h.connectPort((int)Ports::AudioPortOffset + i, pcm_buffer[i]); } - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); // run for 1 samples to trigger kit loading res = h.run(1); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); std::this_thread::sleep_for(std::chrono::seconds(1)); // wait for kit to get loaded (async), seq.addMidiNote(5, 1, 127); @@ -411,7 +411,7 @@ public: { res = h.run(10); std::this_thread::sleep_for(std::chrono::milliseconds(1)); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); //printf("Iteration:\n"); //for(int k = 0; k < 16; k++) { @@ -428,7 +428,7 @@ public: seq.addMidiNote(5, 1, 127); res = h.run(10); std::this_thread::sleep_for(std::chrono::milliseconds(1)); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); /* printf("Iteration:\n"); @@ -451,16 +451,16 @@ public: { for(int j = 0; j < 10; j++) { - DGUNIT_ASSERT_EQUAL(((j==5)?comp_val.f:0), pcm_buffer[k][j]); + uUNIT_ASSERT_EQUAL(((j==5)?comp_val.f:0), pcm_buffer[k][j]); } } seq.clear(); res = h.destroyInstance(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); res = h.close(); - DGUNIT_ASSERT_EQUAL(0, res); + uUNIT_ASSERT_EQUAL(0, res); } }; diff --git a/test/midimapparsertest.cc b/test/midimapparsertest.cc index 006944c..eb4d6d5 100644 --- a/test/midimapparsertest.cc +++ b/test/midimapparsertest.cc @@ -24,20 +24,20 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <midimapparser.h> #include "scopedfile.h" class MidimapParserTest - : public DGUnit + : public uUnit { public: MidimapParserTest() { - DGUNIT_TEST(MidimapParserTest::test); - DGUNIT_TEST(MidimapParserTest::invalid); + uUNIT_TEST(MidimapParserTest::test); + uUNIT_TEST(MidimapParserTest::invalid); } void test() @@ -53,19 +53,19 @@ public: "</midimap>"); MidiMapParser parser; - DGUNIT_ASSERT(parser.parseFile(scoped_file.filename())); + uUNIT_ASSERT(parser.parseFile(scoped_file.filename())); - DGUNIT_ASSERT(parser.midimap.find(54) != parser.midimap.end()); - DGUNIT_ASSERT(parser.midimap.find(60) != parser.midimap.end()); - DGUNIT_ASSERT(parser.midimap.find(55) != parser.midimap.end()); - DGUNIT_ASSERT(parser.midimap.find(62) != parser.midimap.end()); - DGUNIT_ASSERT(parser.midimap.find(56) != parser.midimap.end()); + uUNIT_ASSERT(parser.midimap.find(54) != parser.midimap.end()); + uUNIT_ASSERT(parser.midimap.find(60) != parser.midimap.end()); + uUNIT_ASSERT(parser.midimap.find(55) != parser.midimap.end()); + uUNIT_ASSERT(parser.midimap.find(62) != parser.midimap.end()); + uUNIT_ASSERT(parser.midimap.find(56) != parser.midimap.end()); - DGUNIT_ASSERT_EQUAL(std::string("Crash_left_tip"), parser.midimap[54]); - DGUNIT_ASSERT_EQUAL(std::string("Crash_left_whisker"), parser.midimap[60]); - DGUNIT_ASSERT_EQUAL(std::string("Crash_right_tip"), parser.midimap[55]); - DGUNIT_ASSERT_EQUAL(std::string("Crash_right_whisker"), parser.midimap[62]); - DGUNIT_ASSERT_EQUAL(std::string("Hihat_closed"), parser.midimap[56]); + uUNIT_ASSERT_EQUAL(std::string("Crash_left_tip"), parser.midimap[54]); + uUNIT_ASSERT_EQUAL(std::string("Crash_left_whisker"), parser.midimap[60]); + uUNIT_ASSERT_EQUAL(std::string("Crash_right_tip"), parser.midimap[55]); + uUNIT_ASSERT_EQUAL(std::string("Crash_right_whisker"), parser.midimap[62]); + uUNIT_ASSERT_EQUAL(std::string("Hihat_closed"), parser.midimap[56]); } void invalid() @@ -81,7 +81,7 @@ public: "</midimap>"); MidiMapParser parser; - DGUNIT_ASSERT(!parser.parseFile(scoped_file.filename())); + uUNIT_ASSERT(!parser.parseFile(scoped_file.filename())); } }; diff --git a/test/notifiertest.cc b/test/notifiertest.cc index fe00597..312dca3 100644 --- a/test/notifiertest.cc +++ b/test/notifiertest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <vector> @@ -48,12 +48,12 @@ public: }; class NotifierTest - : public DGUnit + : public uUnit { public: NotifierTest() { - DGUNIT_TEST(NotifierTest::testTest); + uUNIT_TEST(NotifierTest::testTest); } //! This just creates some drumkit. @@ -71,9 +71,9 @@ public: std::vector<Probe*> ref; ref.push_back(&foo1); ref.push_back(&foo2); - DGUNIT_ASSERT_EQUAL(ref.size(), triggers.size()); - DGUNIT_ASSERT_EQUAL(ref[0], triggers[0]); - DGUNIT_ASSERT_EQUAL(ref[1], triggers[1]); + uUNIT_ASSERT_EQUAL(ref.size(), triggers.size()); + uUNIT_ASSERT_EQUAL(ref[0], triggers[0]); + uUNIT_ASSERT_EQUAL(ref[1], triggers[1]); notifier.disconnect(&foo1); notifier.disconnect(&foo2); triggers.clear(); @@ -86,9 +86,9 @@ public: std::vector<Probe*> ref; ref.push_back(&foo2); ref.push_back(&foo1); - DGUNIT_ASSERT_EQUAL(ref.size(), triggers.size()); - DGUNIT_ASSERT_EQUAL(ref[0], triggers[0]); - DGUNIT_ASSERT_EQUAL(ref[1], triggers[1]); + uUNIT_ASSERT_EQUAL(ref.size(), triggers.size()); + uUNIT_ASSERT_EQUAL(ref[0], triggers[0]); + uUNIT_ASSERT_EQUAL(ref[1], triggers[1]); notifier.disconnect(&foo1); notifier.disconnect(&foo2); triggers.clear(); diff --git a/test/paintertest.cc b/test/paintertest.cc index 518a5ac..f471313 100644 --- a/test/paintertest.cc +++ b/test/paintertest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "../plugingui/canvas.h" #include "../plugingui/painter.h" @@ -49,13 +49,13 @@ private: }; class PainterTest - : public DGUnit + : public uUnit { public: PainterTest() { - DGUNIT_TEST(PainterTest::testDrawImage); - DGUNIT_TEST(PainterTest::testDrawText); + uUNIT_TEST(PainterTest::testDrawImage); + uUNIT_TEST(PainterTest::testDrawText); } void testDrawImage() diff --git a/test/powermaptest.cc b/test/powermaptest.cc index 3e94575..bef5bdc 100644 --- a/test/powermaptest.cc +++ b/test/powermaptest.cc @@ -24,17 +24,17 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "../src/powermap.h" class test_powermaptest - : public DGUnit + : public uUnit { public: test_powermaptest() { - DGUNIT_TEST(test_powermaptest::check_values); + uUNIT_TEST(test_powermaptest::check_values); } void check_values() @@ -43,7 +43,7 @@ public: // TODO // std::cout << powermap.map(.8) << std::endl; - // DGUNIT_ASSERT_EQUAL(powermap.map(.8), .8); + // uUNIT_ASSERT_EQUAL(powermap.map(.8), .8); } }; diff --git a/test/randomtest.cc b/test/randomtest.cc index bc79432..a1869f7 100644 --- a/test/randomtest.cc +++ b/test/randomtest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <random.h> @@ -32,14 +32,14 @@ #include <cmath> class RandomTest - : public DGUnit + : public uUnit { public: RandomTest() { - DGUNIT_TEST(RandomTest::rangeTest); - DGUNIT_TEST(RandomTest::normalTest); - DGUNIT_TEST(RandomTest::chooseTest); + uUNIT_TEST(RandomTest::rangeTest); + uUNIT_TEST(RandomTest::normalTest); + uUNIT_TEST(RandomTest::chooseTest); } void rangeTest() @@ -55,16 +55,16 @@ public: { float rand_float = rand.floatInRange(float_lb, float_ub); float rand_int = rand.intInRange(int_lb, int_ub); - DGUNIT_ASSERT(rand_float >= float_lb && rand_float <= float_ub); - DGUNIT_ASSERT(rand_int >= int_lb && rand_int <= int_ub); + uUNIT_ASSERT(rand_float >= float_lb && rand_float <= float_ub); + uUNIT_ASSERT(rand_int >= int_lb && rand_int <= int_ub); } // check if the series of random numbers is the one we expect // for a certain seed. rand = Random(666); - DGUNIT_ASSERT_EQUAL(0, rand.intInRange(0,100)); - DGUNIT_ASSERT_EQUAL(61, rand.intInRange(0,100)); - DGUNIT_ASSERT_EQUAL(23, rand.intInRange(0,100)); + uUNIT_ASSERT_EQUAL(0, rand.intInRange(0,100)); + uUNIT_ASSERT_EQUAL(61, rand.intInRange(0,100)); + uUNIT_ASSERT_EQUAL(23, rand.intInRange(0,100)); } void normalTest() @@ -89,8 +89,8 @@ public: float estimated_stddev = sqrt(sum_of_squares/nr_of_samples - estimated_mean*estimated_mean); float epsilon = 0.1; - DGUNIT_ASSERT(estimated_mean >= real_mean-epsilon && estimated_mean <= real_mean+epsilon); - DGUNIT_ASSERT(estimated_stddev >= real_stddev-epsilon && estimated_stddev <= real_stddev+epsilon); + uUNIT_ASSERT(estimated_mean >= real_mean-epsilon && estimated_mean <= real_mean+epsilon); + uUNIT_ASSERT(estimated_stddev >= real_stddev-epsilon && estimated_stddev <= real_stddev+epsilon); } void chooseTest() @@ -102,7 +102,7 @@ public: for (int i=0; i<nr_of_samples; i++) { - DGUNIT_ASSERT_EQUAL(42, rand.choose(vec)); + uUNIT_ASSERT_EQUAL(42, rand.choose(vec)); } } }; diff --git a/test/resource_test.cc b/test/resource_test.cc index 1beae94..1433dca 100644 --- a/test/resource_test.cc +++ b/test/resource_test.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include "../plugingui/resource.h" @@ -45,14 +45,14 @@ public: }; class ResourceTest - : public DGUnit + : public uUnit { public: ResourceTest() { - DGUNIT_TEST(ResourceTest::externalReadTest); - DGUNIT_TEST(ResourceTest::internalReadTest); - DGUNIT_TEST(ResourceTest::failTest); + uUNIT_TEST(ResourceTest::externalReadTest); + uUNIT_TEST(ResourceTest::internalReadTest); + uUNIT_TEST(ResourceTest::failTest); } DrumkitCreator drumkit_creator; @@ -62,34 +62,34 @@ public: auto filename = drumkit_creator.create0000Wav("0000.wav"); ResourceTester rc(filename); - DGUNIT_ASSERT(!rc.probeIsInternal()); - DGUNIT_ASSERT(rc.valid()); - DGUNIT_ASSERT_EQUAL((size_t)46, rc.size()); + uUNIT_ASSERT(!rc.probeIsInternal()); + uUNIT_ASSERT(rc.valid()); + uUNIT_ASSERT_EQUAL((size_t)46, rc.size()); } void internalReadTest() { ResourceTester rc(":resources/bg.png"); - DGUNIT_ASSERT(rc.probeIsInternal()); - DGUNIT_ASSERT(rc.valid()); - DGUNIT_ASSERT_EQUAL((size_t)1123, rc.size()); + uUNIT_ASSERT(rc.probeIsInternal()); + uUNIT_ASSERT(rc.valid()); + uUNIT_ASSERT_EQUAL((size_t)1123, rc.size()); } void failTest() { { ResourceTester rc("/tmp/"); - DGUNIT_ASSERT(!rc.valid()); + uUNIT_ASSERT(!rc.valid()); } { ResourceTester rc("no_such_file"); - DGUNIT_ASSERT(!rc.valid()); + uUNIT_ASSERT(!rc.valid()); } { ResourceTester rc(":no_such_file"); - DGUNIT_ASSERT(!rc.valid()); + uUNIT_ASSERT(!rc.valid()); } } }; diff --git a/test/semaphoretest.cc b/test/semaphoretest.cc index 470b5a0..807b619 100644 --- a/test/semaphoretest.cc +++ b/test/semaphoretest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <cassert> @@ -45,12 +45,12 @@ std::chrono::nanoseconds dist(const std::chrono::duration<float>& a, } class SemaphoreTest - : public DGUnit + : public uUnit { public: SemaphoreTest() { - DGUNIT_TEST(SemaphoreTest::timeoutTest); + uUNIT_TEST(SemaphoreTest::timeoutTest); } public: @@ -61,22 +61,22 @@ public: { // 1000ms timeout auto start = std::chrono::steady_clock::now(); bool res = sem.wait(std::chrono::milliseconds(1000)); - DGUNIT_ASSERT(!res); // false means timeout + uUNIT_ASSERT(!res); // false means timeout auto stop = std::chrono::steady_clock::now(); // Allow +/-1ms skew - DGUNIT_ASSERT(dist((stop - start), std::chrono::milliseconds(1000)) + uUNIT_ASSERT(dist((stop - start), std::chrono::milliseconds(1000)) < std::chrono::milliseconds(60)); } { // 100ms timeout auto start = std::chrono::steady_clock::now(); bool res = sem.wait(std::chrono::milliseconds(100)); - DGUNIT_ASSERT(!res); // false means timeout + uUNIT_ASSERT(!res); // false means timeout auto stop = std::chrono::steady_clock::now(); // Allow +/-1ms skew - DGUNIT_ASSERT(dist((stop - start), std::chrono::milliseconds(100)) + uUNIT_ASSERT(dist((stop - start), std::chrono::milliseconds(100)) < std::chrono::milliseconds(60)); } } diff --git a/test/syncedsettings.cc b/test/syncedsettings.cc index 5e1e2fd..6f3bc25 100644 --- a/test/syncedsettings.cc +++ b/test/syncedsettings.cc @@ -24,28 +24,28 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <syncedsettings.h> class SyncedSettingsTest - : public DGUnit + : public uUnit { public: SyncedSettingsTest() { - DGUNIT_TEST(SyncedSettingsTest::groupCanBeDefaultInitialized); - DGUNIT_TEST(SyncedSettingsTest::groupDataCanBeCopied); + uUNIT_TEST(SyncedSettingsTest::groupCanBeDefaultInitialized); + uUNIT_TEST(SyncedSettingsTest::groupDataCanBeCopied); - DGUNIT_TEST(SyncedSettingsTest::accessorCanGetFields); - DGUNIT_TEST(SyncedSettingsTest::accessorCanSetFields); + uUNIT_TEST(SyncedSettingsTest::accessorCanGetFields); + uUNIT_TEST(SyncedSettingsTest::accessorCanSetFields); - DGUNIT_TEST(SyncedSettingsTest::groupHasCopyCtor); - DGUNIT_TEST(SyncedSettingsTest::groupHasMoveCtor); - DGUNIT_TEST(SyncedSettingsTest::groupHasCopyAssignOp); - DGUNIT_TEST(SyncedSettingsTest::groupHasMoveAssignOp); + uUNIT_TEST(SyncedSettingsTest::groupHasCopyCtor); + uUNIT_TEST(SyncedSettingsTest::groupHasMoveCtor); + uUNIT_TEST(SyncedSettingsTest::groupHasCopyAssignOp); + uUNIT_TEST(SyncedSettingsTest::groupHasMoveAssignOp); - DGUNIT_TEST(SyncedSettingsTest::mimicRealUse); + uUNIT_TEST(SyncedSettingsTest::mimicRealUse); } private: @@ -78,9 +78,9 @@ public: a.data.msg = "hello"; } TestData copy = data; - DGUNIT_ASSERT_EQUAL(copy.foo, 3.f); - DGUNIT_ASSERT_EQUAL(copy.bar, false); - DGUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(copy.foo, 3.f); + uUNIT_ASSERT_EQUAL(copy.bar, false); + uUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); } void accessorCanGetFields() @@ -95,9 +95,9 @@ public: // now read { Accessor<TestData> a{data}; - DGUNIT_ASSERT_EQUAL(a.data.foo, 3.f); - DGUNIT_ASSERT_EQUAL(a.data.bar, false); - DGUNIT_ASSERT_EQUAL(a.data.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(a.data.foo, 3.f); + uUNIT_ASSERT_EQUAL(a.data.bar, false); + uUNIT_ASSERT_EQUAL(a.data.msg, std::string{"hello"}); } } @@ -112,9 +112,9 @@ public: } Group<TestData> data{tmp}; TestData copy = data; - DGUNIT_ASSERT_EQUAL(copy.foo, 3.f); - DGUNIT_ASSERT_EQUAL(copy.bar, false); - DGUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(copy.foo, 3.f); + uUNIT_ASSERT_EQUAL(copy.bar, false); + uUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); } void groupHasMoveCtor() @@ -128,9 +128,9 @@ public: } Group<TestData> data{std::move(tmp)}; TestData copy = data; - DGUNIT_ASSERT_EQUAL(copy.foo, 3.f); - DGUNIT_ASSERT_EQUAL(copy.bar, false); - DGUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(copy.foo, 3.f); + uUNIT_ASSERT_EQUAL(copy.bar, false); + uUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); } void groupHasCopyAssignOp() @@ -144,9 +144,9 @@ public: } Group<TestData> data = tmp; TestData copy = data; - DGUNIT_ASSERT_EQUAL(copy.foo, 3.f); - DGUNIT_ASSERT_EQUAL(copy.bar, false); - DGUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(copy.foo, 3.f); + uUNIT_ASSERT_EQUAL(copy.bar, false); + uUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); } void groupHasMoveAssignOp() @@ -160,9 +160,9 @@ public: } Group<TestData> data = std::move(tmp); TestData copy = data; - DGUNIT_ASSERT_EQUAL(copy.foo, 3.f); - DGUNIT_ASSERT_EQUAL(copy.bar, false); - DGUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); + uUNIT_ASSERT_EQUAL(copy.foo, 3.f); + uUNIT_ASSERT_EQUAL(copy.bar, false); + uUNIT_ASSERT_EQUAL(copy.msg, std::string{"hello"}); } void mimicRealUse() @@ -204,7 +204,7 @@ public: if (copy.enabled) { // do some stuff without locking } - DGUNIT_ASSERT(copy.enabled); + uUNIT_ASSERT(copy.enabled); } }; diff --git a/test/translationtest.cc b/test/translationtest.cc index f64e1f3..98cff11 100644 --- a/test/translationtest.cc +++ b/test/translationtest.cc @@ -24,7 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "dgunit.h" +#include <uunit.h> #include <locale> @@ -33,13 +33,13 @@ #include <stdlib.h> class TranslationTest - : public DGUnit + : public uUnit { public: TranslationTest() { - DGUNIT_TEST(TranslationTest::testFromFile); - DGUNIT_TEST(TranslationTest::testFromLocale); + uUNIT_TEST(TranslationTest::testFromFile); + uUNIT_TEST(TranslationTest::testFromLocale); } void testFromFile() @@ -47,17 +47,17 @@ public: Translation t; char buf[100000]; FILE* fp = fopen(MO_SRC, "r"); - DGUNIT_ASSERT(fp != nullptr); + uUNIT_ASSERT(fp != nullptr); auto sz = fread(buf, 1, sizeof(buf), fp); fclose(fp); - DGUNIT_ASSERT(t.load(buf, sz)); + uUNIT_ASSERT(t.load(buf, sz)); // Look up translation from .mo file - DGUNIT_ASSERT_EQUAL(std::string("Trommesæt"), + uUNIT_ASSERT_EQUAL(std::string("Trommesæt"), std::string(_("Drumkit"))); // No translation, return key - DGUNIT_ASSERT_EQUAL(std::string("No translation"), + uUNIT_ASSERT_EQUAL(std::string("No translation"), std::string(_("No translation"))); } @@ -67,11 +67,11 @@ public: UITranslation t; // Look up translation from .mo file - DGUNIT_ASSERT_EQUAL(std::string("Trommesæt"), + uUNIT_ASSERT_EQUAL(std::string("Trommesæt"), std::string(_("Drumkit"))); // No translation, return key - DGUNIT_ASSERT_EQUAL(std::string("No translation"), + uUNIT_ASSERT_EQUAL(std::string("No translation"), std::string(_("No translation"))); } }; diff --git a/test/uunit b/test/uunit new file mode 160000 +Subproject e46cf7b5489213ac0f8941c870121b04cf6091a |