Restructure Storage Module -> Connection module
This commit is contained in:
parent
fa4d1d72dc
commit
e9dbee6667
24 changed files with 121 additions and 354 deletions
33
Connection/tests/TestLocal.cpp
Normal file
33
Connection/tests/TestLocal.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
#include "LocalConnection.hpp"
|
||||
#include "Testing.hpp"
|
||||
|
||||
using namespace tp;
|
||||
|
||||
TEST_DEF_STATIC(Simple) {
|
||||
|
||||
const int1* data = "abcde\0";
|
||||
int1 dataRead[6]{};
|
||||
|
||||
{
|
||||
LocalConnection file;
|
||||
file.connect(LocalConnectionLocation(String("tmp2.txt")), LocalConnectionType(false));
|
||||
file.writeBytes(data, 6);
|
||||
file.disconnect();
|
||||
}
|
||||
|
||||
{
|
||||
LocalConnection file;
|
||||
file.connect(LocalConnectionLocation(String("tmp2.txt")), LocalConnectionType(true));
|
||||
file.readBytes(dataRead, 6);
|
||||
file.disconnect();
|
||||
}
|
||||
|
||||
for (auto i = 0; i < 5; i++) {
|
||||
TEST(data[i] == dataRead[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_DEF(LocalConnection) {
|
||||
testSimple();
|
||||
}
|
||||
19
Connection/tests/Tests.cpp
Normal file
19
Connection/tests/Tests.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
#include "ConnectionCommon.hpp"
|
||||
#include "Testing.hpp"
|
||||
|
||||
void testLocalConnection();
|
||||
|
||||
int main() {
|
||||
|
||||
tp::ModuleManifest* deps[] = { &tp::gModuleConnection, nullptr };
|
||||
tp::ModuleManifest testModule("ConnectionTest", nullptr, nullptr, deps);
|
||||
|
||||
if (!testModule.initialize()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
testLocalConnection();
|
||||
|
||||
testModule.deinitialize();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue