diff --git a/test/main.cpp b/test/main.cpp index c50fafe..a2bc740 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -12,19 +12,19 @@ QVector* suites__ = nullptr; } // internal-linkage -TestSuite::TestSuite(void) { +TestSuite::TestSuite() { static struct __ { QVector suites_; - __(void) { suites__ = &suites_; } + __() { suites__ = &suites_; } } _; _.suites_ << this; } -const char* TestSuite::name(void) const { +const char* TestSuite::name() const { return ""; } -void TestSuite::initTestCase(void) { +void TestSuite::initTestCase() { qDebug() << QString("#### Start: %1 ####").arg(name()); } diff --git a/test/test.h b/test/test.h index 5fee10f..5fb915d 100644 --- a/test/test.h +++ b/test/test.h @@ -7,11 +7,11 @@ class TestSuite : public QObject Q_OBJECT public: - explicit TestSuite(void); + explicit TestSuite(); protected: - virtual const char* name(void) const; + virtual const char* name() const; protected slots: - virtual void initTestCase(void); + virtual void initTestCase(); }; diff --git a/test/test_circ.cpp b/test/test_circ.cpp index 23860b3..a3603ad 100644 --- a/test/test_circ.cpp +++ b/test/test_circ.cpp @@ -17,21 +17,21 @@ namespace { class Unit : public TestSuite { Q_OBJECT - const char* name(void) const { + const char* name() const { return "test_circ"; } private slots: - void initTestCase(void); - void cleanupTestCase(void); + void initTestCase(); + void cleanupTestCase(); - void test_inst(void); - void test_prod_cons_1v1(void); - void test_prod_cons_1v3(void); - void test_prod_cons_3v1(void); - void test_prod_cons_performance(void); + void test_inst(); + void test_prod_cons_1v1(); + void test_prod_cons_1v3(); + void test_prod_cons_3v1(); + void test_prod_cons_performance(); - void test_queue(void); + void test_queue(); } unit__; #include "test_circ.moc" @@ -41,16 +41,16 @@ cq_t* cq__; constexpr int LoopCount = 1000000; -void Unit::initTestCase(void) { +void Unit::initTestCase() { TestSuite::initTestCase(); cq__ = new cq_t; } -void Unit::cleanupTestCase(void) { +void Unit::cleanupTestCase() { delete cq__; } -void Unit::test_inst(void) { +void Unit::test_inst() { std::cout << "cq_t::head_size = " << cq_t::head_size << std::endl; std::cout << "cq_t::data_size = " << cq_t::data_size << std::endl; std::cout << "cq_t::elem_size = " << cq_t::elem_size << std::endl; @@ -77,7 +77,7 @@ struct test_stopwatch { capo::stopwatch<> sw_; std::atomic_flag started_ = ATOMIC_FLAG_INIT; - void start(void) { + void start() { if (!started_.test_and_set()) { sw_.start(); } @@ -101,7 +101,7 @@ struct test_verify { ]; } - ~test_verify(void) { + ~test_verify() { delete [] list_; } @@ -152,7 +152,7 @@ struct test_cq> { ::new (ca) ca_t; } - cn_t connect(void) { + cn_t connect() { auto cur = ca_->cursor(); ca_->connect(); return cur; @@ -201,7 +201,7 @@ struct test_cq> { ::new (ca_) ca_t; } - cn_t connect(void) { + cn_t connect() { cn_t queue; [&] { queue.attach(ca_); @@ -284,25 +284,25 @@ void test_prod_cons(T* cq) { } template -void test_prod_cons(void) { +void test_prod_cons() { test_prod_cons(cq__); } -void Unit::test_prod_cons_1v1(void) { +void Unit::test_prod_cons_1v1() { test_prod_cons<1, 1>(); } -void Unit::test_prod_cons_1v3(void) { +void Unit::test_prod_cons_1v3() { test_prod_cons<1, 3>(); } -void Unit::test_prod_cons_3v1(void) { +void Unit::test_prod_cons_3v1() { test_prod_cons<3, 1>(); } template struct test_performance { - static void start(void) { + static void start() { test_performance

::start(); test_prod_cons(); } @@ -310,7 +310,7 @@ struct test_performance { template struct test_performance<1, C> { - static void start(void) { + static void start() { test_performance<1, C - 1>::start(); test_prod_cons<1, C, false>(); } @@ -318,7 +318,7 @@ struct test_performance<1, C> { template struct test_performance { - static void start(void) { + static void start() { test_performance

::start(); test_prod_cons(); } @@ -326,19 +326,19 @@ struct test_performance { template <> struct test_performance<1, 1> { - static void start(void) { + static void start() { test_prod_cons<1, 1, false>(); } }; -void Unit::test_prod_cons_performance(void) { +void Unit::test_prod_cons_performance() { test_performance<1 , 10>::start(); test_performance<10, 1 >::start(); test_performance<10, 10>::start(); test_prod_cons <3 , 3 >(); // test & verify } -void Unit::test_queue(void) { +void Unit::test_queue() { ipc::circ::queue queue; queue.push(1, 2); QVERIFY_EXCEPTION_THROWN(queue.pop(), std::exception); diff --git a/test/test_ipc.cpp b/test/test_ipc.cpp index 31d1748..2f199a7 100644 --- a/test/test_ipc.cpp +++ b/test/test_ipc.cpp @@ -6,17 +6,18 @@ namespace { class Unit : public TestSuite { Q_OBJECT - const char* name(void) const { + const char* name() const { return "test_ipc"; } private slots: - void test_send_recv(void); + void test_send_recv(); + void test_rw_lock(); } unit__; #include "test_ipc.moc" -void Unit::test_send_recv(void) { +void Unit::test_send_recv() { auto h = ipc::connect("my-ipc"); QVERIFY(h != nullptr); char data[] = "hello ipc!"; @@ -26,4 +27,8 @@ void Unit::test_send_recv(void) { ipc::disconnect(h); } +void Unit::test_rw_lock() { + +} + } // internal-linkage diff --git a/test/test_shm.cpp b/test/test_shm.cpp index d49dc60..8d096e0 100644 --- a/test/test_shm.cpp +++ b/test/test_shm.cpp @@ -12,23 +12,23 @@ namespace { class Unit : public TestSuite { Q_OBJECT - const char* name(void) const { + const char* name() const { return "test_shm"; } private slots: - void test_acquire(void); - void test_release(void); - void test_get(void); - void test_hello(void); - void test_mt(void); + void test_acquire(); + void test_release(); + void test_get(); + void test_hello(); + void test_mt(); } unit__; #include "test_shm.moc" handle shm_hd__; -void Unit::test_acquire(void) { +void Unit::test_acquire() { QVERIFY(!shm_hd__.valid()); QVERIFY(shm_hd__.acquire("my-test-1", 1024)); @@ -44,13 +44,13 @@ void Unit::test_acquire(void) { QCOMPARE(shm_hd__.name(), "my-test-3"); } -void Unit::test_release(void) { +void Unit::test_release() { QVERIFY(shm_hd__.valid()); shm_hd__.release(); QVERIFY(!shm_hd__.valid()); } -void Unit::test_get(void) { +void Unit::test_get() { QVERIFY(shm_hd__.get() == nullptr); QVERIFY(shm_hd__.acquire("my-test", 1024)); @@ -66,7 +66,7 @@ void Unit::test_get(void) { QVERIFY(mem == shm_hd__.get()); } -void Unit::test_hello(void) { +void Unit::test_hello() { auto mem = shm_hd__.get(); QVERIFY(mem != nullptr); @@ -76,7 +76,7 @@ void Unit::test_hello(void) { QCOMPARE((char*)shm_hd__.get(), hello); } -void Unit::test_mt(void) { +void Unit::test_mt() { std::thread { [] { handle shm_mt(shm_hd__.name(), shm_hd__.size());