generated from dsavenko/nsu-oop-cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestsFlatMap.cpp
97 lines (62 loc) · 2.04 KB
/
TestsFlatMap.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "FlatMap.h"
#include "gtest/gtest.h"
namespace {
TEST(FlatMapTest, size) {
FlatMap homework;
EXPECT_EQ(homework.size(), 0);
homework["ÄÃÌÀ"] = "3985, 3987, 3989, 3998";
EXPECT_EQ(homework.size(), 1);
homework["ËÎÏ"] = "Ï. 16, 17";
homework["ÝÂÌ"] = "Ëàá. ðàáîòà 1-2";
EXPECT_EQ(homework.size(), 3);
homework["Äèñêðåòêà"] = "1.66";
homework["Ôèçèêà"] = "Èçó÷åíèê òåîðèè";
EXPECT_EQ(homework.size(), 5);
homework.erase("Ôèçèêà");
EXPECT_EQ(homework.size(), 4);
}
TEST(FlatMapTest, contains) {
FlatMap homework;
EXPECT_EQ(homework.contains("ÄÃÌÀ"), false);
homework["ÄÃÌÀ"] = "3985, 3987, 3989, 3998";
EXPECT_EQ(homework.contains("ÄÃÌÀ"), true);
homework["ËÎÏ"] = "Ï. 16, 17";
homework["ÝÂÌ"] = "Ëàá. ðàáîòà 1-2";
EXPECT_EQ(homework.contains("ËÎÏÝÂÌ"), false);
EXPECT_EQ(homework.contains("ËÎÏ"), true);
EXPECT_EQ(homework.contains("ÝÂÌ"), true);
homework.erase("ÝÂÌ");
EXPECT_EQ(homework.contains("ÝÂÌ"), false);
}
TEST(FlatMapTest, erase) {
FlatMap homework;
EXPECT_EQ(homework.erase("ÄÃÌÀ"), 0);
homework["ÄÃÌÀ"] = "3985, 3987, 3989, 3998";
EXPECT_EQ(homework.erase("ÄÃÌÀ"), 1);
homework["ËÎÏ"] = "Ï. 16, 17";
homework["ÝÂÌ"] = "Ëàá. ðàáîòà 1-2";
EXPECT_EQ(homework.erase("ËÎÏÝÂÌ"), 0);
EXPECT_EQ(homework.erase("ÝÂÌ"), 1);
EXPECT_EQ(homework.erase("ÝÂÌ"), 0);
}
TEST(FlatMapTest, clear) {
FlatMap homework;
homework.clear();
EXPECT_EQ(homework.size(), 0);
EXPECT_EQ(homework.contains("ÄÃÌÀ"), false);
homework["ÄÃÌÀ"] = "3985, 3987, 3989, 3998";
EXPECT_EQ(homework.size(), 1);
EXPECT_EQ(homework.contains("ÄÃÌÀ"), true);
homework["ËÎÏ"] = "Ï. 16, 17";
homework["ÝÂÌ"] = "Ëàá. ðàáîòà 1-2";
EXPECT_EQ(homework.size(), 3);
EXPECT_EQ(homework.contains("ËÎÏÝÂÌ"), 0);
EXPECT_EQ(homework.contains("ËÎÏ"), true);
EXPECT_EQ(homework.contains("ÝÂÌ"), true);
homework.clear();
EXPECT_EQ(homework.size(), 0);
EXPECT_EQ(homework.contains("ÄÃÌÀ"), false);
EXPECT_EQ(homework.contains("ËÎÏ"), false);
EXPECT_EQ(homework.contains("ÝÂÌ"), false);
}
}