-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGTestMain.cpp
More file actions
63 lines (51 loc) · 1.69 KB
/
Copy pathGTestMain.cpp
File metadata and controls
63 lines (51 loc) · 1.69 KB
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
#include "gtest/gtest.h"
#include <AyonCppApi.h>
#include <iostream>
#include <string>
#include "Instrumentor.h"
#include "nlohmann/json.hpp"
#include "AyonCppApiTestsMain.h"
nlohmann::json JsonFile;
AyonApi
getApiInstance() {
std::string AYON_API_KEY("SuperSaveTestKey");
std::string AYON_SERVER_URL("http://localhost:8003");
std::string AYON_SITE_ID("TestId");
std::string AYON_PROJECT_NAME("TestPrjName");
return AyonApi("./test_logs", AYON_API_KEY, AYON_SERVER_URL, AYON_PROJECT_NAME, AYON_SITE_ID);
}
TEST(AyonCppApi, AyonCppApiCreation) {
AyonApi Test = getApiInstance();
}
TEST(AyonCppApi, AyonCppApiSerialResolveRootReplace) {
Instrumentor::Get().BeginSession("Profile", "bin/profSerial.json");
AyonApi Api = getApiInstance();
bool RunOnlyOneResolveIteration = false;
bool printResult = false;
if (!AyonCppApiTest::test_SimpleResolve(JsonFile, RunOnlyOneResolveIteration, printResult, Api)) {
FAIL();
}
Instrumentor::Get().EndSession();
}
TEST(AyonCppApi, AyonCppApiBatchResolveRootReplace) {
Instrumentor::Get().BeginSession("Profile", "bin/profBatch.json");
AyonApi Api = getApiInstance();
bool RunOnlyOneResolveIteration = false;
bool printResult = false;
if (!AyonCppApiTest::test_BatchResolve(JsonFile, printResult, Api)) {
FAIL();
}
Instrumentor::Get().EndSession();
std::cout << std::endl;
}
int
main(int argc, char** argv) {
std::ifstream file("test/testData.json");
if (!file.is_open()) {
std::cerr << "Failed to open file!" << std::endl;
}
JsonFile = nlohmann::json::parse(file);
file.close();
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}