Debian Codegraph @

tests/desktop/rule/matchEngine/BoolMatchEngine.cpp

raw symbols SCIP
1 #include <desktop/rule/matchEngine/BoolMatchEngine.hpp>
2
3 #include <gtest/gtest.h>
4
5 using namespace Desktop::Rule;
6
7 TEST(BoolMatchEngine, truthyStringOne) {
8 CBoolMatchEngine engine("1");
9 EXPECT_TRUE(engine.match(true));
10 EXPECT_FALSE(engine.match(false));
11 }
12
13 TEST(BoolMatchEngine, truthyStringTrue) {
14 CBoolMatchEngine engine("true");
15 EXPECT_TRUE(engine.match(true));
16 EXPECT_FALSE(engine.match(false));
17 }
18
19 TEST(BoolMatchEngine, truthyStringYes) {
20 CBoolMatchEngine engine("yes");
21 EXPECT_TRUE(engine.match(true));
22 EXPECT_FALSE(engine.match(false));
23 }
24
25 TEST(BoolMatchEngine, truthyStringOn) {
26 CBoolMatchEngine engine("on");
27 EXPECT_TRUE(engine.match(true));
28 EXPECT_FALSE(engine.match(false));
29 }
30
31 TEST(BoolMatchEngine, truthyCaseInsensitive) {
32 CBoolMatchEngine upper("TRUE");
33 EXPECT_TRUE(upper.match(true));
34
35 CBoolMatchEngine mixed("Yes");
36 EXPECT_TRUE(mixed.match(true));
37
38 CBoolMatchEngine onUpper("ON");
39 EXPECT_TRUE(onUpper.match(true));
40 }
41
42 TEST(BoolMatchEngine, falsyStringZero) {
43 CBoolMatchEngine engine("0");
44 EXPECT_TRUE(engine.match(false));
45 EXPECT_FALSE(engine.match(true));
46 }
47
48 TEST(BoolMatchEngine, falsyStringFalse) {
49 CBoolMatchEngine engine("false");
50 EXPECT_TRUE(engine.match(false));
51 EXPECT_FALSE(engine.match(true));
52 }
53
54 TEST(BoolMatchEngine, falsyStringNo) {
55 CBoolMatchEngine engine("no");
56 EXPECT_TRUE(engine.match(false));
57 EXPECT_FALSE(engine.match(true));
58 }
59
60 TEST(BoolMatchEngine, falsyStringEmpty) {
61 CBoolMatchEngine engine("");
62 EXPECT_TRUE(engine.match(false));
63 EXPECT_FALSE(engine.match(true));
64 }
65
66 TEST(BoolMatchEngine, falsyStringArbitrary) {
67 CBoolMatchEngine engine("banana");
68 EXPECT_TRUE(engine.match(false));
69 EXPECT_FALSE(engine.match(true));
70 }