mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
35 lines
585 B
C++
35 lines
585 B
C++
#include "ipc.h"
|
|
#include "test.h"
|
|
|
|
namespace {
|
|
|
|
class Unit : public TestSuite {
|
|
Q_OBJECT
|
|
|
|
const char* name() const {
|
|
return "test_ipc";
|
|
}
|
|
|
|
private slots:
|
|
void test_send_recv();
|
|
void test_rw_lock();
|
|
} unit__;
|
|
|
|
#include "test_ipc.moc"
|
|
|
|
void Unit::test_send_recv() {
|
|
auto h = ipc::connect("my-ipc");
|
|
QVERIFY(h != nullptr);
|
|
char data[] = "hello ipc!";
|
|
QVERIFY(ipc::send(h, data, sizeof(data)));
|
|
auto got = ipc::recv(h);
|
|
QCOMPARE((char*)got.data(), data);
|
|
ipc::disconnect(h);
|
|
}
|
|
|
|
void Unit::test_rw_lock() {
|
|
|
|
}
|
|
|
|
} // internal-linkage
|