summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/audiocachetest.cc6
-rw-r--r--test/dgreftest/dgreftest.cc5
-rw-r--r--test/enginetest.cc12
-rw-r--r--test/lv2.cc13
-rw-r--r--test/resampler.cc1
5 files changed, 21 insertions, 16 deletions
diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc
index 0e3db10..c03bee4 100644
--- a/test/audiocachetest.cc
+++ b/test/audiocachetest.cc
@@ -26,10 +26,12 @@
*/
#include <cppunit/extensions/HelperMacros.h>
+#include <thread>
+#include <chrono>
+
#include <audiofile.h>
#include <audiocache.h>
#include <settings.h>
-#include <unistd.h>
#include "drumkit_creator.h"
@@ -108,7 +110,7 @@ public:
int timeout = 1000;
while(!audio_cache.isReady(id))
{
- usleep(1000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
if(--timeout == 0)
{
CPPUNIT_ASSERT(false); // timeout
diff --git a/test/dgreftest/dgreftest.cc b/test/dgreftest/dgreftest.cc
index f9eef03..ea38091 100644
--- a/test/dgreftest/dgreftest.cc
+++ b/test/dgreftest/dgreftest.cc
@@ -29,7 +29,8 @@
#include <string>
#include <iostream>
#include <cassert>
-#include <unistd.h>
+#include <thread>
+#include <chrono>
#include <sys/types.h>
#include <sys/stat.h>
@@ -99,7 +100,7 @@ int main(int argc, char* argv[])
while(settings.drumkit_load_status.load() != LoadStatus::Done)
{
- usleep(10000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
int total = settings.number_of_files.load();
int loaded = settings.number_of_files_loaded.load();
diff --git a/test/enginetest.cc b/test/enginetest.cc
index 5e33fe2..ad4315d 100644
--- a/test/enginetest.cc
+++ b/test/enginetest.cc
@@ -26,8 +26,10 @@
*/
#include <cppunit/extensions/HelperMacros.h>
+#include <thread>
+#include <chrono>
+
#include <drumgizmo.h>
-#include <unistd.h>
#include "drumkit_creator.h"
@@ -100,18 +102,18 @@ public:
for(int i = 0; i < 100; ++i)
{
settings.drumkit_file.store(kit1_file);
- usleep(100);
+ std::this_thread::sleep_for(std::chrono::microseconds(100));
settings.drumkit_file.store(kit2_file);
- usleep(100);
+ std::this_thread::sleep_for(std::chrono::microseconds(100));
}
// Switch kits with bigger delay giving the loader time to finish
for(int i = 0; i < 100; ++i)
{
settings.drumkit_file.store(kit1_file);
- usleep(10000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
settings.drumkit_file.store(kit2_file);
- usleep(10000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
};
diff --git a/test/lv2.cc b/test/lv2.cc
index 78bf342..4fd197e 100644
--- a/test/lv2.cc
+++ b/test/lv2.cc
@@ -26,7 +26,8 @@
*/
#include <cppunit/extensions/HelperMacros.h>
-#include <unistd.h>
+#include <thread>
+#include <chrono>
#include <memory.h>
#include <stdio.h>
#include <arpa/inet.h>
@@ -139,7 +140,7 @@ public:
// run for 1 samples to trigger kit loading
res = h.run(1);
CPPUNIT_ASSERT_EQUAL(0, res);
- usleep(1000); // wait for kit to get loaded (async),
+ std::this_thread::sleep_for(std::chrono::milliseconds(1)); // wait for kit to get loaded (async),
res = h.run(100);
CPPUNIT_ASSERT_EQUAL(0, res);
@@ -217,7 +218,7 @@ public:
// run for 1 samples to trigger kit loading
res = h.run(1);
CPPUNIT_ASSERT_EQUAL(0, res);
- usleep(1000); // wait for kit to get loaded (async),
+ 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);
@@ -307,13 +308,13 @@ public:
// run for 1 samples to trigger kit loading
res = h.run(1);
CPPUNIT_ASSERT_EQUAL(0, res);
- sleep(1); // wait for kit to get loaded (async),
+ std::this_thread::sleep_for(std::chrono::seconds(1)); // wait for kit to get loaded (async),
seq.addMidiNote(5, 1, 127);
for(int i = 0; i < 10; i++)
{
res = h.run(10);
- usleep(1000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
CPPUNIT_ASSERT_EQUAL(0, res);
//printf("Iteration:\n");
@@ -330,7 +331,7 @@ public:
seq.addMidiNote(5, 1, 127);
res = h.run(10);
- usleep(1000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
CPPUNIT_ASSERT_EQUAL(0, res);
/*
diff --git a/test/resampler.cc b/test/resampler.cc
index fa52cbf..2b6862d 100644
--- a/test/resampler.cc
+++ b/test/resampler.cc
@@ -27,7 +27,6 @@
#include <cppunit/extensions/HelperMacros.h>
#include "../src/chresampler.h"
-#include <unistd.h>
#define BUFSZ 500