9 #include <gmock/gmock.h>
10 #include <gtest/gtest.h>
14 using namespace ::testing;
42 EXPECT_EQ(State::NotStarted, s.
GetState()) <<
"Default state should be State::NotStarted";
43 EXPECT_FALSE(s.
GetError()) <<
"By default error flag should be false";
46 EXPECT_EQ(State::Starting, s.
GetState());
55 MatchesRegex(
"ObservableStatus\\(id='id', file_id='fileid', state=.*, error=false\\)"));
65 std::vector<DpPart> files = {{
"origin1",
"path1"}, {
"origin2",
"path2"}};
76 TEST(TestStatus, OstreamOperator) {
82 MatchesRegex(
"Status\\(id='id', file_id='fileid', state=.*, error=false, result=''\\)"));
85 TEST(TestStatus, Comparison) {
102 ASSERT_EQ(1, s1.
alerts.size());
103 EXPECT_EQ(s1.
alerts[0], alert);
104 EXPECT_EQ(s1.
alerts[0].description,
"description");
107 alert2.
id.
key =
"different key";
111 ASSERT_EQ(2, s1.
alerts.size());
115 EXPECT_EQ(s1.
alerts[0].description,
"new description");
119 ASSERT_EQ(1, s1.
alerts.size());
120 EXPECT_EQ(s1.
alerts[0], alert2);
123 TEST(TestAlertId, Comparison) {
127 EXPECT_EQ(alert1, alert1);
129 auto alert2 = alert1;
130 alert2.
key =
"different key";
131 EXPECT_NE(alert1, alert2);
133 auto alert3 = alert1;
134 alert3.
category =
"different category";
135 EXPECT_NE(alert1, alert3);
141 alert1.
id.
key =
"key";
143 EXPECT_EQ(alert1, alert1);
145 auto alert2 = alert1;
146 alert2.
id.
key =
"different key";
147 EXPECT_NE(alert1, alert2);
149 auto alert3 = alert1;
151 EXPECT_NE(alert1, alert3);