|
1 | 1 | #include "countly.hpp" |
2 | 2 | #include "doctest.h" |
3 | | -#ifdef _WIN32 |
4 | | -#include <Windows.h> |
5 | | -#else |
6 | | -#include <unistd.h> |
7 | | -#endif |
| 3 | + |
| 4 | +#include <chrono> |
| 5 | +#include <thread> |
8 | 6 |
|
9 | 7 | using namespace cly; |
| 8 | +using namespace std::literals::chrono_literals; |
10 | 9 |
|
11 | 10 | /** |
12 | 11 | * Validate view data. |
@@ -65,7 +64,7 @@ TEST_CASE("recording views") { |
65 | 64 | nlohmann::json s = e["segmentation"].get<nlohmann::json>(); |
66 | 65 | validateViewSegmentation(e, "view1", eid, 0, true, true); |
67 | 66 |
|
68 | | - Sleep(3000); |
| 67 | + std::this_thread::sleep_for(3s); |
69 | 68 | ct.views().closeViewWithName("view1"); |
70 | 69 | eventSize++; |
71 | 70 | CHECK(ct.debugReturnStateOfEQ().size() == eventSize); |
@@ -94,7 +93,7 @@ TEST_CASE("recording views") { |
94 | 93 |
|
95 | 94 | validateViewSegmentation(e, "view1", eid, 0, true); |
96 | 95 |
|
97 | | - Sleep(2000); |
| 96 | + std::this_thread::sleep_for(2s); |
98 | 97 |
|
99 | 98 | ct.views().closeViewWithID(eid); |
100 | 99 | eventSize++; |
@@ -138,7 +137,7 @@ TEST_CASE("recording views") { |
138 | 137 | CHECK(s["platform"].get<std::string>() == "ubuntu"); |
139 | 138 | CHECK(s["time"].get<std::string>() == "60"); |
140 | 139 |
|
141 | | - Sleep(3000); |
| 140 | + std::this_thread::sleep_for(3s); |
142 | 141 |
|
143 | 142 | ct.views().closeViewWithName("view2"); |
144 | 143 | eventSize++; |
@@ -173,7 +172,7 @@ TEST_CASE("recording views") { |
173 | 172 | CHECK(s["platform"].get<std::string>() == "ubuntu"); |
174 | 173 | CHECK(s["time"].get<std::string>() == "60"); |
175 | 174 |
|
176 | | - Sleep(1000); |
| 175 | + std::this_thread::sleep_for(1s); |
177 | 176 |
|
178 | 177 | ct.views().closeViewWithID(eid); |
179 | 178 | eventSize++; |
|
0 commit comments