Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 1 | #include "dbus_environment.hpp" |
| 2 | #include "discrete_threshold.hpp" |
| 3 | #include "helpers.hpp" |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 4 | #include "mocks/clock_mock.hpp" |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 5 | #include "mocks/sensor_mock.hpp" |
| 6 | #include "mocks/trigger_action_mock.hpp" |
Krzysztof Grobelny | 51f0fd5 | 2021-12-28 16:32:08 +0100 | [diff] [blame] | 7 | #include "types/duration_types.hpp" |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 8 | #include "utils/conv_container.hpp" |
| 9 | |
| 10 | #include <gmock/gmock.h> |
| 11 | |
| 12 | using namespace testing; |
| 13 | using namespace std::chrono_literals; |
| 14 | |
| 15 | class TestDiscreteThreshold : public Test |
| 16 | { |
| 17 | public: |
| 18 | std::vector<std::shared_ptr<SensorMock>> sensorMocks = { |
| 19 | std::make_shared<NiceMock<SensorMock>>(), |
| 20 | std::make_shared<NiceMock<SensorMock>>()}; |
| 21 | std::vector<std::string> sensorNames = {"Sensor1", "Sensor2"}; |
| 22 | std::unique_ptr<TriggerActionMock> actionMockPtr = |
| 23 | std::make_unique<StrictMock<TriggerActionMock>>(); |
| 24 | TriggerActionMock& actionMock = *actionMockPtr; |
| 25 | std::shared_ptr<DiscreteThreshold> sut; |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 26 | std::string triggerId = "MyTrigger"; |
| 27 | std::unique_ptr<NiceMock<ClockMock>> clockMockPtr = |
| 28 | std::make_unique<NiceMock<ClockMock>>(); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 29 | |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 30 | std::shared_ptr<DiscreteThreshold> |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 31 | makeThreshold(Milliseconds dwellTime, std::string thresholdValue, |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 32 | discrete::Severity severity = discrete::Severity::ok, |
| 33 | std::string thresholdName = "treshold name") |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 34 | { |
| 35 | std::vector<std::unique_ptr<interfaces::TriggerAction>> actions; |
| 36 | actions.push_back(std::move(actionMockPtr)); |
| 37 | |
| 38 | return std::make_shared<DiscreteThreshold>( |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 39 | DbusEnvironment::getIoc(), triggerId, |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 40 | utils::convContainer<std::shared_ptr<interfaces::Sensor>>( |
| 41 | sensorMocks), |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 42 | std::move(actions), dwellTime, thresholdValue, thresholdName, |
| 43 | severity, std::move(clockMockPtr)); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | void SetUp() override |
| 47 | { |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 48 | for (size_t idx = 0; idx < sensorMocks.size(); idx++) |
| 49 | { |
| 50 | ON_CALL(*sensorMocks.at(idx), getName()) |
| 51 | .WillByDefault(Return(sensorNames[idx])); |
| 52 | } |
| 53 | |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 54 | sut = makeThreshold(0ms, "90.0", discrete::Severity::critical); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 55 | } |
| 56 | }; |
| 57 | |
| 58 | TEST_F(TestDiscreteThreshold, initializeThresholdExpectAllSensorsAreRegistered) |
| 59 | { |
| 60 | for (auto& sensor : sensorMocks) |
| 61 | { |
| 62 | EXPECT_CALL(*sensor, |
| 63 | registerForUpdates(Truly([sut = sut.get()](const auto& x) { |
| 64 | return x.lock().get() == sut; |
| 65 | }))); |
| 66 | } |
| 67 | |
| 68 | sut->initialize(); |
| 69 | } |
| 70 | |
| 71 | TEST_F(TestDiscreteThreshold, thresholdIsNotInitializeExpectNoActionCommit) |
| 72 | { |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 73 | EXPECT_CALL(actionMock, commit(_, _, _, _, _)).Times(0); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 74 | } |
| 75 | |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 76 | class TestDiscreteThresholdValues : |
| 77 | public TestDiscreteThreshold, |
| 78 | public WithParamInterface<std::string> |
| 79 | {}; |
| 80 | |
| 81 | INSTANTIATE_TEST_SUITE_P(_, TestDiscreteThresholdValues, |
| 82 | Values("90", ".90", "90.123", "0.0")); |
| 83 | |
| 84 | TEST_P(TestDiscreteThresholdValues, thresholdValueIsNumericAndStoredCorrectly) |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 85 | { |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 86 | sut = makeThreshold(0ms, GetParam(), discrete::Severity::critical); |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 87 | LabeledThresholdParam expected = discrete::LabeledThresholdParam( |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 88 | "treshold name", discrete::Severity::critical, 0, GetParam()); |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 89 | EXPECT_EQ(sut->getThresholdParam(), expected); |
| 90 | } |
| 91 | |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 92 | class TestBadDiscreteThresholdValues : |
| 93 | public TestDiscreteThreshold, |
| 94 | public WithParamInterface<std::string> |
| 95 | {}; |
| 96 | |
| 97 | INSTANTIATE_TEST_SUITE_P(_, TestBadDiscreteThresholdValues, |
| 98 | Values("90ad", "ab.90", "x90", "On", "Off", "")); |
| 99 | |
| 100 | TEST_P(TestBadDiscreteThresholdValues, throwsWhenNotNumericValues) |
| 101 | { |
| 102 | EXPECT_THROW(makeThreshold(0ms, GetParam()), std::invalid_argument); |
| 103 | } |
| 104 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 105 | class TestDiscreteThresholdInit : public TestDiscreteThreshold |
| 106 | { |
Patrick Williams | 3a1c297 | 2023-05-10 07:51:04 -0500 | [diff] [blame^] | 107 | void SetUp() override {} |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | TEST_F(TestDiscreteThresholdInit, nonEmptyNameIsNotChanged) |
| 111 | { |
| 112 | auto sut = makeThreshold(0ms, "12.3", discrete::Severity::ok, "non-empty"); |
| 113 | EXPECT_THAT( |
| 114 | std::get<discrete::LabeledThresholdParam>(sut->getThresholdParam()) |
| 115 | .at_label<utils::tstring::UserId>(), |
| 116 | Eq("non-empty")); |
| 117 | } |
| 118 | |
| 119 | TEST_F(TestDiscreteThresholdInit, emptyNameIsChanged) |
| 120 | { |
| 121 | auto sut = makeThreshold(0ms, "12.3", discrete::Severity::ok, ""); |
| 122 | EXPECT_THAT( |
| 123 | std::get<discrete::LabeledThresholdParam>(sut->getThresholdParam()) |
| 124 | .at_label<utils::tstring::UserId>(), |
| 125 | Not(Eq(""))); |
| 126 | } |
| 127 | |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 128 | struct DiscreteParams |
| 129 | { |
| 130 | struct UpdateParams |
| 131 | { |
| 132 | size_t sensor; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 133 | double value; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 134 | Milliseconds sleepAfter; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 135 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 136 | UpdateParams(size_t sensor, double value, |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 137 | Milliseconds sleepAfter = 0ms) : |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 138 | sensor(sensor), |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 139 | value(value), sleepAfter(sleepAfter) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 140 | {} |
| 141 | }; |
| 142 | |
| 143 | struct ExpectedParams |
| 144 | { |
| 145 | size_t sensor; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 146 | double value; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 147 | Milliseconds waitMin; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 148 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 149 | ExpectedParams(size_t sensor, double value, |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 150 | Milliseconds waitMin = 0ms) : |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 151 | sensor(sensor), |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 152 | value(value), waitMin(waitMin) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 153 | {} |
| 154 | }; |
| 155 | |
| 156 | DiscreteParams& Updates(std::vector<UpdateParams> val) |
| 157 | { |
| 158 | updates = std::move(val); |
| 159 | return *this; |
| 160 | } |
| 161 | |
| 162 | DiscreteParams& Expected(std::vector<ExpectedParams> val) |
| 163 | { |
| 164 | expected = std::move(val); |
| 165 | return *this; |
| 166 | } |
| 167 | |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 168 | DiscreteParams& ThresholdValue(std::string val) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 169 | { |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 170 | thresholdValue = std::move(val); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 171 | return *this; |
| 172 | } |
| 173 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 174 | DiscreteParams& DwellTime(Milliseconds val) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 175 | { |
| 176 | dwellTime = std::move(val); |
| 177 | return *this; |
| 178 | } |
| 179 | |
| 180 | friend void PrintTo(const DiscreteParams& o, std::ostream* os) |
| 181 | { |
| 182 | *os << "{ DwellTime: " << o.dwellTime.count() << "ms "; |
| 183 | *os << ", ThresholdValue: " << o.thresholdValue; |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 184 | *os << ", Updates: [ "; |
| 185 | for (const auto& [index, value, sleepAfter] : o.updates) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 186 | { |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 187 | *os << "{ SensorIndex: " << index << ", Value: " << value |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 188 | << ", SleepAfter: " << sleepAfter.count() << "ms }, "; |
| 189 | } |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 190 | *os << " ] Expected: [ "; |
| 191 | for (const auto& [index, value, waitMin] : o.expected) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 192 | { |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 193 | *os << "{ SensorIndex: " << index << ", Value: " << value |
Krzysztof Grobelny | 51f0fd5 | 2021-12-28 16:32:08 +0100 | [diff] [blame] | 194 | << ", waitMin: " << waitMin.count() << "ms }, "; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 195 | } |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 196 | *os << " ] }"; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | std::vector<UpdateParams> updates; |
| 200 | std::vector<ExpectedParams> expected; |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 201 | std::string thresholdValue = "0.0"; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 202 | Milliseconds dwellTime = 0ms; |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | class TestDiscreteThresholdCommon : |
| 206 | public TestDiscreteThreshold, |
| 207 | public WithParamInterface<DiscreteParams> |
| 208 | { |
| 209 | public: |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 210 | void sleep(Milliseconds duration) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 211 | { |
| 212 | if (duration != 0ms) |
| 213 | { |
| 214 | DbusEnvironment::sleepFor(duration); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | void testBodySensorIsUpdatedMultipleTimes() |
| 219 | { |
| 220 | std::vector<std::chrono::time_point<std::chrono::high_resolution_clock>> |
| 221 | timestamps(sensorMocks.size()); |
| 222 | |
| 223 | sut->initialize(); |
| 224 | |
| 225 | InSequence seq; |
| 226 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 227 | for (const auto& [index, value, waitMin] : GetParam().expected) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 228 | { |
| 229 | EXPECT_CALL(actionMock, |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 230 | commit(triggerId, Optional(StrEq("treshold name")), |
| 231 | sensorNames[index], _, |
| 232 | TriggerValue(GetParam().thresholdValue))) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 233 | .WillOnce(DoAll( |
| 234 | InvokeWithoutArgs([idx = index, ×tamps] { |
| 235 | timestamps[idx] = |
| 236 | std::chrono::high_resolution_clock::now(); |
| 237 | }), |
| 238 | InvokeWithoutArgs(DbusEnvironment::setPromise("commit")))); |
| 239 | } |
| 240 | |
| 241 | auto start = std::chrono::high_resolution_clock::now(); |
| 242 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 243 | for (const auto& [index, value, sleepAfter] : GetParam().updates) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 244 | { |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 245 | sut->sensorUpdated(*sensorMocks[index], 42ms, value); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 246 | sleep(sleepAfter); |
| 247 | } |
| 248 | |
| 249 | EXPECT_THAT(DbusEnvironment::waitForFutures("commit"), true); |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 250 | for (const auto& [index, value, waitMin] : GetParam().expected) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 251 | { |
| 252 | EXPECT_THAT(timestamps[index] - start, Ge(waitMin)); |
| 253 | } |
| 254 | } |
| 255 | }; |
| 256 | |
| 257 | class TestDiscreteThresholdNoDwellTime : public TestDiscreteThresholdCommon |
| 258 | { |
| 259 | public: |
| 260 | void SetUp() override |
| 261 | { |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 262 | for (size_t idx = 0; idx < sensorMocks.size(); idx++) |
| 263 | { |
| 264 | ON_CALL(*sensorMocks.at(idx), getName()) |
| 265 | .WillByDefault(Return(sensorNames[idx])); |
| 266 | } |
| 267 | |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 268 | sut = makeThreshold(0ms, GetParam().thresholdValue); |
| 269 | } |
| 270 | }; |
| 271 | |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 272 | INSTANTIATE_TEST_SUITE_P( |
| 273 | _, TestDiscreteThresholdNoDwellTime, |
| 274 | Values(DiscreteParams() |
| 275 | .ThresholdValue("90.0") |
| 276 | .Updates({{0, 80.0}, {0, 89.0}}) |
| 277 | .Expected({}), |
| 278 | DiscreteParams() |
| 279 | .ThresholdValue("90.0") |
| 280 | .Updates({{0, 80.0}, {0, 90.0}, {0, 80.0}, {0, 90.0}}) |
| 281 | .Expected({{0, 90.0}, {0, 90.0}}), |
| 282 | DiscreteParams() |
| 283 | .ThresholdValue("90.0") |
| 284 | .Updates({{0, 90.0}, {0, 99.0}, {1, 100.0}, {1, 90.0}}) |
| 285 | .Expected({{0, 90.0}, {1, 90.0}}))); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 286 | |
| 287 | TEST_P(TestDiscreteThresholdNoDwellTime, senorsIsUpdatedMultipleTimes) |
| 288 | { |
| 289 | testBodySensorIsUpdatedMultipleTimes(); |
| 290 | } |
| 291 | |
| 292 | class TestDiscreteThresholdWithDwellTime : public TestDiscreteThresholdCommon |
| 293 | { |
| 294 | public: |
| 295 | void SetUp() override |
| 296 | { |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 297 | for (size_t idx = 0; idx < sensorMocks.size(); idx++) |
| 298 | { |
| 299 | ON_CALL(*sensorMocks.at(idx), getName()) |
| 300 | .WillByDefault(Return(sensorNames[idx])); |
| 301 | } |
| 302 | |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 303 | sut = makeThreshold(GetParam().dwellTime, GetParam().thresholdValue); |
| 304 | } |
| 305 | }; |
| 306 | |
| 307 | INSTANTIATE_TEST_SUITE_P( |
| 308 | _, TestDiscreteThresholdWithDwellTime, |
| 309 | Values(DiscreteParams() |
| 310 | .DwellTime(200ms) |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 311 | .ThresholdValue("90.0") |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 312 | .Updates({{0, 90.0, 100ms}, {0, 91.0}, {0, 90.0}}) |
| 313 | .Expected({{0, 90.0, 300ms}}), |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 314 | DiscreteParams() |
| 315 | .DwellTime(100ms) |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 316 | .ThresholdValue("90.0") |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 317 | .Updates({{0, 90.0, 100ms}}) |
| 318 | .Expected({{0, 90.0, 100ms}}), |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 319 | DiscreteParams() |
| 320 | .DwellTime(1000ms) |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 321 | .ThresholdValue("90.0") |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 322 | .Updates({{0, 90.0, 700ms}, |
| 323 | {0, 91.0, 100ms}, |
| 324 | {0, 90.0, 300ms}, |
| 325 | {0, 91.0, 100ms}}) |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 326 | .Expected({}), |
| 327 | DiscreteParams() |
| 328 | .DwellTime(200ms) |
Szymon Dompke | aa57236 | 2022-03-23 16:31:24 +0100 | [diff] [blame] | 329 | .ThresholdValue("90.0") |
Szymon Dompke | b7b7e1b | 2022-05-19 10:15:48 +0200 | [diff] [blame] | 330 | .Updates({{0, 90.0}, |
| 331 | {1, 89.0, 100ms}, |
| 332 | {1, 90.0, 100ms}, |
| 333 | {1, 89.0, 100ms}, |
| 334 | {1, 90.0, 300ms}, |
| 335 | {1, 89.0, 100ms}}) |
| 336 | .Expected({{0, 90, 200ms}, {1, 90, 500ms}}))); |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 337 | |
| 338 | TEST_P(TestDiscreteThresholdWithDwellTime, senorsIsUpdatedMultipleTimes) |
| 339 | { |
| 340 | testBodySensorIsUpdatedMultipleTimes(); |
| 341 | } |