summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/double_buffer_test.cpp5
-rw-r--r--test/path_test.cpp8
-rw-r--r--test/ringbuffer_test.cpp3
-rw-r--r--test/socket_test.cpp4
-rw-r--r--test/symbol_test.cpp13
-rw-r--r--test/thread_test.cpp19
-rw-r--r--test/time_test.cpp23
7 files changed, 35 insertions, 40 deletions
diff --git a/test/double_buffer_test.cpp b/test/double_buffer_test.cpp
index d4d0554..5148f88 100644
--- a/test/double_buffer_test.cpp
+++ b/test/double_buffer_test.cpp
@@ -16,13 +16,10 @@
#include "raul/DoubleBuffer.hpp"
-using namespace std;
-using namespace Raul;
-
int
main(int argc, char** argv)
{
- DoubleBuffer<int> db(0);
+ Raul::DoubleBuffer<int> db(0);
if (db.get() != 0) {
return 1;
diff --git a/test/path_test.cpp b/test/path_test.cpp
index 3b7b61b..9391063 100644
--- a/test/path_test.cpp
+++ b/test/path_test.cpp
@@ -21,15 +21,15 @@
#include <iostream>
#include <string>
-using namespace std;
-using namespace Raul;
-
int
main()
{
+ using Path = Raul::Path;
+ using Symbol = Raul::Symbol;
+
#define CHECK(cond) \
do { if (!(cond)) { \
- cerr << "Test failed: " << (cond) << endl; \
+ std::cerr << "Test failed: " << (cond) << std::endl; \
return 1; \
} } while (0)
diff --git a/test/ringbuffer_test.cpp b/test/ringbuffer_test.cpp
index 1c488be..aeebacd 100644
--- a/test/ringbuffer_test.cpp
+++ b/test/ringbuffer_test.cpp
@@ -24,9 +24,6 @@
#include <string>
#include <thread>
-using namespace std;
-using namespace Raul;
-
#define MSG_SIZE 20
namespace {
diff --git a/test/socket_test.cpp b/test/socket_test.cpp
index 2472c21..1a5c80f 100644
--- a/test/socket_test.cpp
+++ b/test/socket_test.cpp
@@ -35,8 +35,8 @@ main(int argc, char** argv)
std::string unix_uri("unix:///tmp/raul_test_sock");
std::string tcp_uri("tcp://127.0.0.1:12345");
- Raul::Socket unix_server_sock(Socket::Type::UNIX);
- Raul::Socket tcp_server_sock(Socket::Type::TCP);
+ Socket unix_server_sock(Socket::Type::UNIX);
+ Socket tcp_server_sock(Socket::Type::TCP);
if (!unix_server_sock.bind(unix_uri)) {
fprintf(stderr, "Failed to bind UNIX server socket (%s)\n",
strerror(errno));
diff --git a/test/symbol_test.cpp b/test/symbol_test.cpp
index edc8879..0fa0039 100644
--- a/test/symbol_test.cpp
+++ b/test/symbol_test.cpp
@@ -20,19 +20,18 @@
#include <list>
#include <string>
-using namespace std;
-using namespace Raul;
-
int
main()
{
+ using Symbol = Raul::Symbol;
+
#define CHECK(cond) \
do { if (!(cond)) { \
- cerr << "Test failed: " << (cond) << endl; \
+ std::cerr << "Test failed: " << (cond) << std::endl; \
return 1; \
} } while (0)
- list<string> names;
+ std::list<std::string> names;
names.push_back("Dry/Wet Balance");
names.push_back("foo+1bar(baz)");
names.push_back("ThisCRAR");
@@ -47,8 +46,8 @@ main()
names.push_back("1");
names.push_back("");
- for (list<string>::iterator i = names.begin(); i != names.end(); ++i) {
- CHECK(!Symbol::symbolify(*i).empty());
+ for (const auto& name : names) {
+ CHECK(!Symbol::symbolify(name).empty());
}
Symbol original("sym");
diff --git a/test/thread_test.cpp b/test/thread_test.cpp
index 78c0ad2..72ba93f 100644
--- a/test/thread_test.cpp
+++ b/test/thread_test.cpp
@@ -20,11 +20,10 @@
#include <iostream>
#include <thread>
-using namespace std;
-using namespace Raul;
-
namespace {
+using Semaphore = Raul::Semaphore;
+
thread_local int var(0);
std::atomic<int> n_errors(0);
@@ -32,12 +31,12 @@ void
wait_for_sem(Semaphore* sem)
{
var = 41;
- cout << "[Waiter] Waiting for signal..." << endl;
+ std::cout << "[Waiter] Waiting for signal..." << std::endl;
sem->wait();
- cout << "[Waiter] Received signal, exiting" << endl;
+ std::cout << "[Waiter] Received signal, exiting" << std::endl;
var = 42;
if (var != 42) {
- cerr << "[Waiter] var != 42" << endl;
+ std::cerr << "[Waiter] var != 42" << std::endl;
++n_errors;
}
}
@@ -52,16 +51,16 @@ main()
var = 24;
- cout << "[Main] Signalling..." << endl;
+ std::cout << "[Main] Signalling..." << std::endl;
sem.post();
- cout << "[Main] Waiting for waiter..." << endl;
+ std::cout << "[Main] Waiting for waiter..." << std::endl;
waiter.join();
- cout << "[Main] Exiting" << endl;
+ std::cout << "[Main] Exiting" << std::endl;
if (var != 24) {
- cerr << "[Main] var != 24" << endl;
+ std::cerr << "[Main] var != 24" << std::endl;
++n_errors;
}
diff --git a/test/time_test.cpp b/test/time_test.cpp
index c6f3d77..61b9b9a 100644
--- a/test/time_test.cpp
+++ b/test/time_test.cpp
@@ -26,21 +26,24 @@ using namespace Raul;
int
main()
{
- TimeUnit unit(TimeUnit::BEATS, 19200);
- TimeSlice ts(48000, 19200, 120.0);
+ Raul::TimeUnit unit(Raul::TimeUnit::BEATS, 19200);
+ Raul::TimeSlice ts(48000, 19200, 120.0);
double in_double = 2.5;
- TimeStamp t(unit, static_cast<uint32_t>(in_double),
- static_cast<uint32_t>((in_double - static_cast<uint32_t>(in_double)) * unit.ppt()));
+ Raul::TimeStamp t(unit,
+ static_cast<uint32_t>(in_double),
+ static_cast<uint32_t>(
+ (in_double - static_cast<uint32_t>(in_double)) *
+ unit.ppt()));
- cout << "\tSeconds: ";
- cout << ts.beats_to_seconds(t);
- cout << endl;
+ std::cout << "\tSeconds: ";
+ std::cout << ts.beats_to_seconds(t);
+ std::cout << std::endl;
- cout << "\tTicks: ";
- cout << ts.beats_to_ticks(t);
- cout << endl;
+ std::cout << "\tTicks: ";
+ std::cout << ts.beats_to_ticks(t);
+ std::cout << std::endl;
return 0;
}