-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.cpp
78 lines (47 loc) · 1.47 KB
/
tests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "cache.h"
#include "net.h"
#include "scraper.h"
#include "palantir.hpp"
#include <catch2/catch_session.hpp>
#include <catch2/catch_test_macros.hpp>
bool testSocket(const std::string& str){
std::make_unique<Socket>(str.c_str());
return true;
}
bool testRedis(const std::string& IP, int Port){
auto cache = Cache(IP, Port);
return true;
}
int main(int argc, char* argv[]) {
//Catch2
int result = Catch::Session().run(
argc, argv
);
return result;
}
TEST_CASE("Packets: JSON Parse") {
auto testpacketIn = Palantir::dataPacketIn{19019};
nlohmann::json j_obj = testpacketIn;
REQUIRE(testpacketIn.id == 19019);
REQUIRE(testpacketIn.expac == Palantir::E_EXPANSION::CLASSIC);
REQUIRE(testpacketIn.type == Palantir::E_INPUT::PING);
}
TEST_CASE("Config: Redis") {
Palantir::Config CfgTest;
CfgTest.LoadConfig();
auto Cfg = CfgTest.GetConfig();
REQUIRE(testRedis(Cfg->redis_ip, Cfg->redis_port) == true);
REQUIRE(testSocket(Cfg->ipc_path) == true);
}
TEST_CASE("Config: UNIX Socket") {
Palantir::Config CfgTest;
CfgTest.LoadConfig();
auto Cfg = CfgTest.GetConfig();
REQUIRE(testSocket(Cfg->ipc_path) == true);
}
TEST_CASE("Scraper: HTTPS") {
auto QueuePtr = std::make_shared<Palantir::IPCQueue>();
auto S = Scraper(
Palantir::dataPacketIn{19019}, QueuePtr
);
}