|
4 | 4 | TEST_CASE("events are serialized correctly") { |
5 | 5 | SUBCASE("without segmentation") { |
6 | 6 | SUBCASE("without sum") { |
7 | | - Countly::Event event("win", 1); |
| 7 | + cly::Event event("win", 1); |
8 | 8 | CHECK(event.serialize() == "{\"count\":1,\"key\":\"win\"}"); |
9 | 9 | } |
10 | 10 |
|
11 | 11 | SUBCASE("with sum") { |
12 | | - Countly::Event event("buy", 2, 9.99); |
| 12 | + cly::Event event("buy", 2, 9.99); |
13 | 13 | CHECK(event.serialize() == "{\"count\":2,\"key\":\"buy\",\"sum\":9.99}"); |
14 | 14 | } |
15 | 15 | } |
16 | 16 |
|
17 | 17 | SUBCASE("with segmentation") { |
18 | 18 | SUBCASE("with signed integer") { |
19 | | - Countly::Event event("lose", 3); |
| 19 | + cly::Event event("lose", 3); |
20 | 20 | event.addSegmentation("points", -144); |
21 | 21 | CHECK(event.serialize() == "{\"count\":3,\"key\":\"lose\",\"segmentation\":{\"points\":-144}}"); |
22 | 22 | } |
23 | 23 |
|
24 | 24 | SUBCASE("with unsigned integer") { |
25 | | - Countly::Event event("win", 1); |
| 25 | + cly::Event event("win", 1); |
26 | 26 | event.addSegmentation("points", 232U); |
27 | 27 | CHECK(event.serialize() == "{\"count\":1,\"key\":\"win\",\"segmentation\":{\"points\":232}}"); |
28 | 28 | } |
29 | 29 |
|
30 | 30 | SUBCASE("with boolean") { |
31 | | - Countly::Event event("win", 1); |
| 31 | + cly::Event event("win", 1); |
32 | 32 | event.addSegmentation("alive", true); |
33 | 33 | CHECK(event.serialize() == "{\"count\":1,\"key\":\"win\",\"segmentation\":{\"alive\":true}}"); |
34 | 34 | } |
35 | 35 |
|
36 | 36 | SUBCASE("with string") { |
37 | | - Countly::Event event("message", 1); |
| 37 | + cly::Event event("message", 1); |
38 | 38 | event.addSegmentation("sender", "TheLegend27"); |
39 | 39 | CHECK(event.serialize() == "{\"count\":1,\"key\":\"message\",\"segmentation\":{\"sender\":\"TheLegend27\"}}"); |
40 | 40 | } |
41 | 41 |
|
42 | 42 | SUBCASE("with multiple values") { |
43 | | - Countly::Event event("buy", 5); |
| 43 | + cly::Event event("buy", 5); |
44 | 44 | event.addSegmentation("quantity", 27); |
45 | 45 | event.addSegmentation("searchQuery", "cheap cheese"); |
46 | 46 | CHECK(event.serialize() == "{\"count\":5,\"key\":\"buy\",\"segmentation\":{\"quantity\":27,\"searchQuery\":\"cheap cheese\"}}"); |
47 | 47 | } |
48 | 48 |
|
49 | 49 | SUBCASE("with changing values") { |
50 | | - Countly::Event event("lose", 3); |
| 50 | + cly::Event event("lose", 3); |
51 | 51 | event.addSegmentation("points", -144); |
52 | 52 | event.addSegmentation("points", 2000); |
53 | 53 | CHECK(event.serialize() == "{\"count\":3,\"key\":\"lose\",\"segmentation\":{\"points\":2000}}"); |
54 | 54 | } |
55 | 55 |
|
56 | 56 | SUBCASE("with count, sum, duration and segmentation") { |
57 | | - Countly::Event event("lose", 3, 10, 100); |
| 57 | + cly::Event event("lose", 3, 10, 100); |
58 | 58 | event.addSegmentation("points", 2000); |
59 | 59 | CHECK(event.serialize() == "{\"count\":3,\"dur\":100.0,\"key\":\"lose\",\"segmentation\":{\"points\":2000},\"sum\":10.0}"); |
60 | 60 | } |
61 | 61 |
|
62 | 62 | SUBCASE("with multibyte strings") { |
63 | | - Countly::Event event("测试", 1); |
| 63 | + cly::Event event("测试", 1); |
64 | 64 | event.addSegmentation("苹果", "美味"); |
65 | 65 | CHECK(event.serialize() == "{\"count\":1,\"key\":\"测试\",\"segmentation\":{\"苹果\":\"美味\"}}"); |
66 | 66 | } |
|
0 commit comments