From 286cddccfd9d69f4bc567fc9f00898f06315cd30 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 6 May 2017 16:33:10 +0200 Subject: Get rid of unused unistd includes. Change the rest of the sleep calls to c++. --- test/audiocachetest.cc | 6 ++++-- test/dgreftest/dgreftest.cc | 5 +++-- test/enginetest.cc | 12 +++++++----- test/lv2.cc | 13 +++++++------ test/resampler.cc | 1 - 5 files changed, 21 insertions(+), 16 deletions(-) (limited to 'test') 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 +#include +#include + #include #include #include -#include #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 #include #include -#include +#include +#include #include #include @@ -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 +#include +#include + #include -#include #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 -#include +#include +#include #include #include #include @@ -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 #include "../src/chresampler.h" -#include #define BUFSZ 500 -- cgit v1.2.3