From ae96f2a5d8e4bd0597a411fc6a5b66bb2b741af9 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 8 May 2016 15:57:15 +0200 Subject: Fix engine unit test. --- test/engine.cc | 57 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'test') diff --git a/test/engine.cc b/test/engine.cc index 89c0158..c9d99cd 100644 --- a/test/engine.cc +++ b/test/engine.cc @@ -31,7 +31,7 @@ class test_engine : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(test_engine); + CPPUNIT_TEST_SUITE(test_engine); CPPUNIT_TEST(loading); CPPUNIT_TEST_SUITE_END(); @@ -39,37 +39,40 @@ public: void setUp() {} void tearDown() {} - void loading() { - Settings settings; - AudioOutputEngine *oe = NULL; - AudioInputEngine *ie = NULL; - DrumGizmo dg(settings, oe, ie); - dg.setFrameSize(100); + void loading() + { + Settings settings; + AudioOutputEngine *oe = NULL; + AudioInputEngine *ie = NULL; + DrumGizmo dg(settings, oe, ie); + dg.setFrameSize(100); - // Switch kits emmidiately with giving the loader time to work: - for(int i = 0; i < 100; i++) { - dg.loadkit("kit/kit1.xml"); - dg.loadkit("kit/kit2.xml"); - } + // Switch kits emmidiately without giving the loader time to work: + for(int i = 0; i < 100; ++i) + { + settings.drumkit_file.store("kit/kit1.xml"); + settings.drumkit_file.store("kit/kit2.xml"); + } - // Switch kits with delay with giving the loader time to work a little: - for(int i = 0; i < 100; i++) { - dg.loadkit("kit/kit1.xml"); - usleep(100); - dg.loadkit("kit/kit2.xml"); - usleep(100); - } + // Switch kits with small delay giving the loader time to work a little: + for(int i = 0; i < 100; ++i) + { + settings.drumkit_file.store("kit/kit1.xml"); + usleep(100); + settings.drumkit_file.store("kit/kit2.xml"); + usleep(100); + } - // Switch kits with more delay with giving the loader time to finish - for(int i = 0; i < 100; i++) { - dg.loadkit("kit/kit1.xml"); - usleep(10000); - dg.loadkit("kit/kit2.xml"); - usleep(10000); - } + // Switch kits with bigger delay giving the loader time to finish + for(int i = 0; i < 100; ++i) + { + settings.drumkit_file.store("kit/kit1.xml"); + usleep(10000); + settings.drumkit_file.store("kit/kit2.xml"); + usleep(10000); + } } }; // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION(test_engine); - -- cgit v1.2.3