Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 1 | #include <set> |
| 2 | #include <algorithm> |
| 3 | #include <gtest/gtest.h> |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 4 | #include <sdbusplus/bus.hpp> |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 5 | #include "manager.hpp" |
| 6 | #include "led-test-map.hpp" |
| 7 | |
| 8 | using namespace phosphor::led; |
| 9 | class LedTest : public ::testing::Test |
| 10 | { |
| 11 | public: |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 12 | sdbusplus::bus::bus bus; |
| 13 | LedTest() : bus(sdbusplus::bus::new_default()) |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 14 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 15 | // Nothing here |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 16 | } |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 17 | ~LedTest() |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 18 | { |
| 19 | // Leaving upto auto cleanup. |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | /** @brief Assert Single LED to On */ |
| 24 | TEST_F(LedTest, assertSingleLedOn) |
| 25 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 26 | Manager manager(bus, singleLedOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 27 | { |
| 28 | // Assert the LEDs. |
| 29 | Manager::group ledsAssert {}; |
| 30 | Manager::group ledsDeAssert {}; |
| 31 | Manager::group ledsUpdate {}; |
| 32 | |
| 33 | auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed"; |
| 34 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 35 | ledsDeAssert, ledsUpdate); |
| 36 | EXPECT_EQ(true, result); |
| 37 | |
| 38 | // Need just the ledsAssserted populated with these. |
| 39 | std::set<Layout::LedAction> refAssert = { |
| 40 | {"One",phosphor::led::Layout::On}, |
| 41 | }; |
| 42 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 43 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 44 | EXPECT_EQ(0, ledsUpdate.size()); |
| 45 | |
| 46 | // difference of refAssert and ledsAssert must be null. |
| 47 | Manager::group temp {}; |
| 48 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 49 | refAssert.begin(), refAssert.end(), |
| 50 | std::inserter(temp, temp.begin())); |
| 51 | EXPECT_EQ(0, temp.size()); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** @brief Assert Single LED to Blink */ |
| 56 | TEST_F(LedTest, assertSingleLedBlink) |
| 57 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 58 | Manager manager(bus, singleLedBlink); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 59 | { |
| 60 | // Assert the LEDs. |
| 61 | Manager::group ledsAssert {}; |
| 62 | Manager::group ledsDeAssert {}; |
| 63 | Manager::group ledsUpdate {}; |
| 64 | |
| 65 | auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed"; |
| 66 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 67 | ledsDeAssert, ledsUpdate); |
| 68 | EXPECT_EQ(true, result); |
| 69 | |
| 70 | // Need just the ledsAssserted populated with these. |
| 71 | std::set<Layout::LedAction> refAssert = { |
| 72 | {"One",phosphor::led::Layout::Blink}, |
| 73 | }; |
| 74 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 75 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 76 | EXPECT_EQ(0, ledsUpdate.size()); |
| 77 | |
| 78 | // difference of refAssert and ledsAssert must be null. |
| 79 | Manager::group temp {}; |
| 80 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 81 | refAssert.begin(), refAssert.end(), |
| 82 | std::inserter(temp, temp.begin())); |
| 83 | EXPECT_EQ(0, temp.size()); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | /** @brief Assert Single LED to On and Try Assert Again */ |
| 88 | TEST_F(LedTest, assertSingleLedOnAndreAssert) |
| 89 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 90 | Manager manager(bus, singleLedOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 91 | { |
| 92 | // Assert the LEDs. |
| 93 | Manager::group ledsAssert {}; |
| 94 | Manager::group ledsDeAssert {}; |
| 95 | Manager::group ledsUpdate {}; |
| 96 | |
| 97 | auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed"; |
| 98 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 99 | ledsDeAssert, ledsUpdate); |
| 100 | EXPECT_EQ(true, result); |
| 101 | |
| 102 | // Need just the ledsAssserted populated with these. |
| 103 | std::set<Layout::LedAction> refAssert = { |
| 104 | {"One",phosphor::led::Layout::On}, |
| 105 | }; |
| 106 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 107 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 108 | EXPECT_EQ(0, ledsUpdate.size()); |
| 109 | |
| 110 | // difference of refAssert and ledsAssert must be null. |
| 111 | Manager::group temp {}; |
| 112 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 113 | refAssert.begin(), refAssert.end(), |
| 114 | std::inserter(temp, temp.begin())); |
| 115 | EXPECT_EQ(0, temp.size()); |
| 116 | } |
| 117 | { |
| 118 | // Assert the LEDs. |
| 119 | Manager::group ledsAssert {}; |
| 120 | Manager::group ledsDeAssert {}; |
| 121 | Manager::group ledsUpdate {}; |
| 122 | |
| 123 | auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed"; |
| 124 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 125 | ledsDeAssert, ledsUpdate); |
| 126 | EXPECT_EQ(true, result); |
| 127 | |
| 128 | EXPECT_EQ(0, ledsAssert.size()); |
| 129 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 130 | EXPECT_EQ(0, ledsUpdate.size()); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /** @brief Assert Multiple LEDs to On */ |
| 135 | TEST_F(LedTest, assertMultipleLedOn) |
| 136 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 137 | Manager manager(bus, multipleLedsOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 138 | { |
| 139 | // Assert the LEDs. |
| 140 | Manager::group ledsAssert {}; |
| 141 | Manager::group ledsDeAssert {}; |
| 142 | Manager::group ledsUpdate {}; |
| 143 | |
| 144 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 145 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 146 | ledsDeAssert, ledsUpdate); |
| 147 | EXPECT_EQ(true, result); |
| 148 | |
| 149 | // Need just the ledsAssserted populated with these. |
| 150 | std::set<Layout::LedAction> refAssert = { |
| 151 | {"One",phosphor::led::Layout::On}, |
| 152 | {"Two",phosphor::led::Layout::On}, |
| 153 | {"Three",phosphor::led::Layout::On}, |
| 154 | }; |
| 155 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 156 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 157 | EXPECT_EQ(0, ledsUpdate.size()); |
| 158 | |
| 159 | // difference of refAssert and ledsAssert must be null. |
| 160 | Manager::group temp {}; |
| 161 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 162 | refAssert.begin(), refAssert.end(), |
| 163 | std::inserter(temp, temp.begin())); |
| 164 | EXPECT_EQ(0, temp.size()); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | /** @brief Assert Multiple LEDs to Blink */ |
| 169 | TEST_F(LedTest, assertMultipleLedBlink) |
| 170 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 171 | Manager manager(bus, multipleLedsBlink); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 172 | { |
| 173 | // Assert the LEDs. |
| 174 | Manager::group ledsAssert {}; |
| 175 | Manager::group ledsDeAssert {}; |
| 176 | Manager::group ledsUpdate {}; |
| 177 | |
| 178 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 179 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 180 | ledsDeAssert, ledsUpdate); |
| 181 | EXPECT_EQ(true, result); |
| 182 | |
| 183 | // Need just the ledsAssserted populated with these. |
| 184 | std::set<Layout::LedAction> refAssert = { |
| 185 | {"One",phosphor::led::Layout::Blink}, |
| 186 | {"Two",phosphor::led::Layout::Blink}, |
| 187 | {"Three",phosphor::led::Layout::Blink}, |
| 188 | }; |
| 189 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 190 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 191 | EXPECT_EQ(0, ledsUpdate.size()); |
| 192 | |
| 193 | // difference of refAssert and ledsAssert must be null. |
| 194 | Manager::group temp {}; |
| 195 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 196 | refAssert.begin(), refAssert.end(), |
| 197 | std::inserter(temp, temp.begin())); |
| 198 | EXPECT_EQ(0, temp.size()); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | /** @brief Assert Multiple LEDs to Blink, DeAssert */ |
| 203 | TEST_F(LedTest, assertMultipleLedBlinkAndDeAssert) |
| 204 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 205 | Manager manager(bus, multipleLedsBlink); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 206 | { |
| 207 | // Assert the LEDs. |
| 208 | Manager::group ledsAssert {}; |
| 209 | Manager::group ledsDeAssert {}; |
| 210 | Manager::group ledsUpdate {}; |
| 211 | |
| 212 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 213 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 214 | ledsDeAssert, ledsUpdate); |
| 215 | EXPECT_EQ(true, result); |
| 216 | |
| 217 | // Need just the ledsAssserted populated with these. |
| 218 | std::set<Layout::LedAction> refAssert = { |
| 219 | {"One",phosphor::led::Layout::Blink}, |
| 220 | {"Two",phosphor::led::Layout::Blink}, |
| 221 | {"Three",phosphor::led::Layout::Blink}, |
| 222 | }; |
| 223 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 224 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 225 | EXPECT_EQ(0, ledsUpdate.size()); |
| 226 | |
| 227 | // difference of refAssert and ledsAssert must be null. |
| 228 | Manager::group temp {}; |
| 229 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 230 | refAssert.begin(), refAssert.end(), |
| 231 | std::inserter(temp, temp.begin())); |
| 232 | EXPECT_EQ(0, temp.size()); |
| 233 | } |
| 234 | { |
| 235 | // Assert the LEDs. |
| 236 | Manager::group ledsAssert {}; |
| 237 | Manager::group ledsDeAssert {}; |
| 238 | Manager::group ledsUpdate {}; |
| 239 | |
| 240 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 241 | auto result = manager.setGroupState(group, false, ledsAssert, |
| 242 | ledsDeAssert, ledsUpdate); |
| 243 | EXPECT_EQ(false, result); |
| 244 | |
| 245 | // Need just the ledsAssserted populated with these. |
| 246 | std::set<Layout::LedAction> refDeAssert = { |
| 247 | {"One",phosphor::led::Layout::Blink}, |
| 248 | {"Two",phosphor::led::Layout::Blink}, |
| 249 | {"Three",phosphor::led::Layout::Blink}, |
| 250 | }; |
| 251 | EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size()); |
| 252 | EXPECT_EQ(0, ledsAssert.size()); |
| 253 | EXPECT_EQ(0, ledsUpdate.size()); |
| 254 | |
| 255 | // difference of refDeAssert and ledsDeAssert must be null. |
| 256 | Manager::group temp {}; |
| 257 | std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(), |
| 258 | refDeAssert.begin(), refDeAssert.end(), |
| 259 | std::inserter(temp, temp.begin())); |
| 260 | EXPECT_EQ(0, temp.size()); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | /** @brief Assert Multiple LEDs to Blink, DeAssert Twice */ |
| 265 | TEST_F(LedTest, assertMultipleLedBlinkAndDeAssertTwice) |
| 266 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 267 | Manager manager(bus, multipleLedsBlink); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 268 | { |
| 269 | // Assert the LEDs. |
| 270 | Manager::group ledsAssert {}; |
| 271 | Manager::group ledsDeAssert {}; |
| 272 | Manager::group ledsUpdate {}; |
| 273 | |
| 274 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 275 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 276 | ledsDeAssert, ledsUpdate); |
| 277 | EXPECT_EQ(true, result); |
| 278 | |
| 279 | // Need just the ledsAssserted populated with these. |
| 280 | std::set<Layout::LedAction> refAssert = { |
| 281 | {"One",phosphor::led::Layout::Blink}, |
| 282 | {"Two",phosphor::led::Layout::Blink}, |
| 283 | {"Three",phosphor::led::Layout::Blink}, |
| 284 | }; |
| 285 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 286 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 287 | EXPECT_EQ(0, ledsUpdate.size()); |
| 288 | |
| 289 | // difference of refAssert and ledsAssert must be null. |
| 290 | Manager::group temp {}; |
| 291 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 292 | refAssert.begin(), refAssert.end(), |
| 293 | std::inserter(temp, temp.begin())); |
| 294 | EXPECT_EQ(0, temp.size()); |
| 295 | } |
| 296 | { |
| 297 | // DeAssert the LEDs. |
| 298 | Manager::group ledsAssert {}; |
| 299 | Manager::group ledsDeAssert {}; |
| 300 | Manager::group ledsUpdate {}; |
| 301 | |
| 302 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 303 | auto result = manager.setGroupState(group, false, ledsAssert, |
| 304 | ledsDeAssert, ledsUpdate); |
| 305 | EXPECT_EQ(false, result); |
| 306 | |
| 307 | // Need just the ledsAssserted populated with these. |
| 308 | std::set<Layout::LedAction> refDeAssert = { |
| 309 | {"One",phosphor::led::Layout::Blink}, |
| 310 | {"Two",phosphor::led::Layout::Blink}, |
| 311 | {"Three",phosphor::led::Layout::Blink}, |
| 312 | }; |
| 313 | EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size()); |
| 314 | EXPECT_EQ(0, ledsAssert.size()); |
| 315 | EXPECT_EQ(0, ledsUpdate.size()); |
| 316 | |
| 317 | // difference of refDeAssert and ledsDeAssert must be null. |
| 318 | Manager::group temp {}; |
| 319 | std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(), |
| 320 | refDeAssert.begin(), refDeAssert.end(), |
| 321 | std::inserter(temp, temp.begin())); |
| 322 | EXPECT_EQ(0, temp.size()); |
| 323 | } |
| 324 | { |
| 325 | // DeAssert the LEDs. |
| 326 | Manager::group ledsAssert {}; |
| 327 | Manager::group ledsDeAssert {}; |
| 328 | Manager::group ledsUpdate {}; |
| 329 | |
| 330 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds"; |
| 331 | auto result = manager.setGroupState(group, false, ledsAssert, |
| 332 | ledsDeAssert, ledsUpdate); |
| 333 | EXPECT_EQ(false, result); |
| 334 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 335 | EXPECT_EQ(0, ledsAssert.size()); |
| 336 | EXPECT_EQ(0, ledsUpdate.size()); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /** @brief Assert Multiple LEDs to mix of On and Blink */ |
| 341 | TEST_F(LedTest, assertMultipleLedOnAndBlink) |
| 342 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 343 | Manager manager(bus, multipleLedsOnAndBlink); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 344 | { |
| 345 | // Assert the LEDs. |
| 346 | Manager::group ledsAssert {}; |
| 347 | Manager::group ledsDeAssert {}; |
| 348 | Manager::group ledsUpdate {}; |
| 349 | |
| 350 | auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix"; |
| 351 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 352 | ledsDeAssert, ledsUpdate); |
| 353 | EXPECT_EQ(true, result); |
| 354 | |
| 355 | // Need just the ledsAssserted populated with these. |
| 356 | std::set<Layout::LedAction> refAssert = { |
| 357 | {"One",phosphor::led::Layout::Blink}, |
| 358 | {"Two",phosphor::led::Layout::On}, |
| 359 | {"Three",phosphor::led::Layout::Blink}, |
| 360 | {"Four",phosphor::led::Layout::On}, |
| 361 | {"Five",phosphor::led::Layout::On}, |
| 362 | }; |
| 363 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 364 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 365 | EXPECT_EQ(0, ledsUpdate.size()); |
| 366 | |
| 367 | // difference of refAssert and ledsAssert must be null. |
| 368 | Manager::group temp {}; |
| 369 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 370 | refAssert.begin(), refAssert.end(), |
| 371 | std::inserter(temp, temp.begin())); |
| 372 | EXPECT_EQ(0, temp.size()); |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /** @brief Assert 2 groups having distinct LEDs */ |
| 377 | TEST_F(LedTest, assertTwoGroupsOnWithDistinctLEDOn) |
| 378 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 379 | Manager manager(bus, twoGroupsWithDistinctLEDsOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 380 | { |
| 381 | // Assert Set-A |
| 382 | Manager::group ledsAssert {}; |
| 383 | Manager::group ledsDeAssert {}; |
| 384 | Manager::group ledsUpdate {}; |
| 385 | |
| 386 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 387 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 388 | ledsDeAssert, ledsUpdate); |
| 389 | EXPECT_EQ(true, result); |
| 390 | |
| 391 | // Need just the ledsAssserted populated with these. |
| 392 | std::set<Layout::LedAction> refAssert = { |
| 393 | {"One",phosphor::led::Layout::On}, |
| 394 | {"Two",phosphor::led::Layout::On}, |
| 395 | {"Three",phosphor::led::Layout::On}, |
| 396 | }; |
| 397 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 398 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 399 | EXPECT_EQ(0, ledsUpdate.size()); |
| 400 | |
| 401 | // difference of refAssert and ledsAssert must be null. |
| 402 | Manager::group temp {}; |
| 403 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 404 | refAssert.begin(), refAssert.end(), |
| 405 | std::inserter(temp, temp.begin())); |
| 406 | EXPECT_EQ(0, temp.size()); |
| 407 | } |
| 408 | { |
| 409 | // Assert Set-B |
| 410 | Manager::group ledsAssert {}; |
| 411 | Manager::group ledsDeAssert {}; |
| 412 | Manager::group ledsUpdate {}; |
| 413 | |
| 414 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 415 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 416 | ledsDeAssert, ledsUpdate); |
| 417 | EXPECT_EQ(true, result); |
| 418 | |
| 419 | // Need just the ledsAssserted populated with these. |
| 420 | std::set<Layout::LedAction> refAssert = { |
| 421 | {"Four",phosphor::led::Layout::On}, |
| 422 | {"Five",phosphor::led::Layout::On}, |
| 423 | {"Six",phosphor::led::Layout::On}, |
| 424 | }; |
| 425 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 426 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 427 | EXPECT_EQ(0, ledsUpdate.size()); |
| 428 | |
| 429 | // difference of refAssert and ledsAssert must be null. |
| 430 | Manager::group temp {}; |
| 431 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 432 | refAssert.begin(), refAssert.end(), |
| 433 | std::inserter(temp, temp.begin())); |
| 434 | EXPECT_EQ(0, temp.size()); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | /** @brief Assert 2 groups having one of the LEDs common */ |
| 439 | TEST_F(LedTest, asserttwoGroupsWithOneComonLEDOn) |
| 440 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 441 | Manager manager(bus, twoGroupsWithOneComonLEDOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 442 | { |
| 443 | // Assert Set-A |
| 444 | Manager::group ledsAssert {}; |
| 445 | Manager::group ledsDeAssert {}; |
| 446 | Manager::group ledsUpdate {}; |
| 447 | |
| 448 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 449 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 450 | ledsDeAssert, ledsUpdate); |
| 451 | EXPECT_EQ(true, result); |
| 452 | |
| 453 | // Need just the ledsAssserted populated with these. |
| 454 | std::set<Layout::LedAction> refAssert = { |
| 455 | {"One",phosphor::led::Layout::On}, |
| 456 | {"Two",phosphor::led::Layout::On}, |
| 457 | {"Three",phosphor::led::Layout::On}, |
| 458 | }; |
| 459 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 460 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 461 | EXPECT_EQ(0, ledsUpdate.size()); |
| 462 | |
| 463 | // difference of refAssert and ledsAssert must be null. |
| 464 | Manager::group temp {}; |
| 465 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 466 | refAssert.begin(), refAssert.end(), |
| 467 | std::inserter(temp, temp.begin())); |
| 468 | EXPECT_EQ(0, temp.size()); |
| 469 | } |
| 470 | { |
| 471 | // Assert Set-B |
| 472 | Manager::group ledsAssert {}; |
| 473 | Manager::group ledsDeAssert {}; |
| 474 | Manager::group ledsUpdate {}; |
| 475 | |
| 476 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 477 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 478 | ledsDeAssert, ledsUpdate); |
| 479 | EXPECT_EQ(true, result); |
| 480 | |
| 481 | // Need just the ledsAssserted populated with these. |
| 482 | std::set<Layout::LedAction> refAssert = { |
| 483 | {"Four",phosphor::led::Layout::On}, |
| 484 | {"Six",phosphor::led::Layout::On}, |
| 485 | }; |
| 486 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 487 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 488 | EXPECT_EQ(0, ledsUpdate.size()); |
| 489 | |
| 490 | // difference of refAssert and ledsAssert must be null. |
| 491 | Manager::group temp {}; |
| 492 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 493 | refAssert.begin(), refAssert.end(), |
| 494 | std::inserter(temp, temp.begin())); |
| 495 | EXPECT_EQ(0, temp.size()); |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | /** @brief Assert 2 groups having one of the LEDs common in different state */ |
| 500 | TEST_F(LedTest, assertTwoGroupsWithOneComonLEDInDifferentState) |
| 501 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 502 | Manager manager(bus, twoGroupsWithOneComonLEDInDifferentState); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 503 | { |
| 504 | // Assert Set-A |
| 505 | Manager::group ledsAssert {}; |
| 506 | Manager::group ledsDeAssert {}; |
| 507 | Manager::group ledsUpdate {}; |
| 508 | |
| 509 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 510 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 511 | ledsDeAssert, ledsUpdate); |
| 512 | EXPECT_EQ(true, result); |
| 513 | |
| 514 | // Need just the ledsAssserted populated with these. |
| 515 | std::set<Layout::LedAction> refAssert = { |
| 516 | {"One",phosphor::led::Layout::On}, |
| 517 | {"Two",phosphor::led::Layout::On}, |
| 518 | {"Three",phosphor::led::Layout::On}, |
| 519 | }; |
| 520 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 521 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 522 | EXPECT_EQ(0, ledsUpdate.size()); |
| 523 | |
| 524 | // difference of refAssert and ledsAssert must be null. |
| 525 | Manager::group temp {}; |
| 526 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 527 | refAssert.begin(), refAssert.end(), |
| 528 | std::inserter(temp, temp.begin())); |
| 529 | EXPECT_EQ(0, temp.size()); |
| 530 | } |
| 531 | { |
| 532 | // Assert Set-B |
| 533 | Manager::group ledsAssert {}; |
| 534 | Manager::group ledsDeAssert {}; |
| 535 | Manager::group ledsUpdate {}; |
| 536 | |
| 537 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 538 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 539 | ledsDeAssert, ledsUpdate); |
| 540 | EXPECT_EQ(true, result); |
| 541 | |
| 542 | // Need just the ledsAssserted populated with these. |
| 543 | std::set<Layout::LedAction> refAssert = { |
| 544 | {"Two",phosphor::led::Layout::Blink}, |
| 545 | {"Four",phosphor::led::Layout::On}, |
| 546 | {"Five",phosphor::led::Layout::On}, |
| 547 | {"Six",phosphor::led::Layout::On}, |
| 548 | }; |
| 549 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 550 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 551 | EXPECT_EQ(0, ledsUpdate.size()); |
| 552 | |
| 553 | // difference of refAssert and ledsAssert must be null. |
| 554 | Manager::group temp {}; |
| 555 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 556 | refAssert.begin(), refAssert.end(), |
| 557 | std::inserter(temp, temp.begin())); |
| 558 | EXPECT_EQ(0, temp.size()); |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | /** @brief Assert 2 groups having multiple common LEDs in Same State */ |
| 563 | TEST_F(LedTest, assertTwoGroupsWithMultiplComonLEDOn) |
| 564 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 565 | Manager manager(bus, twoGroupsWithMultiplComonLEDOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 566 | { |
| 567 | // Assert Set-B |
| 568 | Manager::group ledsAssert {}; |
| 569 | Manager::group ledsDeAssert {}; |
| 570 | Manager::group ledsUpdate {}; |
| 571 | |
| 572 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 573 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 574 | ledsDeAssert, ledsUpdate); |
| 575 | EXPECT_EQ(true, result); |
| 576 | |
| 577 | // Need just the ledsAssserted populated with these. |
| 578 | std::set<Layout::LedAction> refAssert = { |
| 579 | {"Two",phosphor::led::Layout::On}, |
| 580 | {"Six",phosphor::led::Layout::On}, |
| 581 | {"Three",phosphor::led::Layout::On}, |
| 582 | {"Seven",phosphor::led::Layout::On}, |
| 583 | }; |
| 584 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 585 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 586 | EXPECT_EQ(0, ledsUpdate.size()); |
| 587 | |
| 588 | // difference of refAssert and ledsAssert must be null. |
| 589 | Manager::group temp {}; |
| 590 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 591 | refAssert.begin(), refAssert.end(), |
| 592 | std::inserter(temp, temp.begin())); |
| 593 | EXPECT_EQ(0, temp.size()); |
| 594 | } |
| 595 | { |
| 596 | // Assert Set-A |
| 597 | Manager::group ledsAssert {}; |
| 598 | Manager::group ledsDeAssert {}; |
| 599 | Manager::group ledsUpdate {}; |
| 600 | |
| 601 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 602 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 603 | ledsDeAssert, ledsUpdate); |
| 604 | EXPECT_EQ(true, result); |
| 605 | |
| 606 | // Need just the ledsAssserted populated with these. |
| 607 | std::set<Layout::LedAction> refAssert = { |
| 608 | {"One",phosphor::led::Layout::On}, |
| 609 | }; |
| 610 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 611 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 612 | EXPECT_EQ(0, ledsUpdate.size()); |
| 613 | |
| 614 | // difference of refAssert and ledsAssert must be null. |
| 615 | Manager::group temp {}; |
| 616 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 617 | refAssert.begin(), refAssert.end(), |
| 618 | std::inserter(temp, temp.begin())); |
| 619 | EXPECT_EQ(0, temp.size()); |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | /** @brief Assert 2 groups having multiple LEDs common in different state */ |
| 624 | TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStates) |
| 625 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 626 | Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 627 | { |
| 628 | // Assert Set-A |
| 629 | Manager::group ledsAssert {}; |
| 630 | Manager::group ledsDeAssert {}; |
| 631 | Manager::group ledsUpdate {}; |
| 632 | |
| 633 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 634 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 635 | ledsDeAssert, ledsUpdate); |
| 636 | EXPECT_EQ(true, result); |
| 637 | |
| 638 | // Need just the ledsAssserted populated with these. |
| 639 | std::set<Layout::LedAction> refAssert = { |
| 640 | {"One",phosphor::led::Layout::On}, |
| 641 | {"Two",phosphor::led::Layout::Blink}, |
| 642 | {"Three",phosphor::led::Layout::On}, |
| 643 | {"Four",phosphor::led::Layout::On}, |
| 644 | }; |
| 645 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 646 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 647 | EXPECT_EQ(0, ledsUpdate.size()); |
| 648 | |
| 649 | // difference of refAssert and ledsAssert must be null. |
| 650 | Manager::group temp {}; |
| 651 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 652 | refAssert.begin(), refAssert.end(), |
| 653 | std::inserter(temp, temp.begin())); |
| 654 | EXPECT_EQ(0, temp.size()); |
| 655 | } |
| 656 | { |
| 657 | // Assert Set-B |
| 658 | Manager::group ledsAssert {}; |
| 659 | Manager::group ledsDeAssert {}; |
| 660 | Manager::group ledsUpdate {}; |
| 661 | |
| 662 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 663 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 664 | ledsDeAssert, ledsUpdate); |
| 665 | EXPECT_EQ(true, result); |
| 666 | |
| 667 | // Need just the ledsAssserted populated with these. |
| 668 | std::set<Layout::LedAction> refAssert = { |
| 669 | {"Two",phosphor::led::Layout::On}, |
| 670 | {"Three",phosphor::led::Layout::Blink}, |
| 671 | {"Five",phosphor::led::Layout::On}, |
| 672 | {"Six",phosphor::led::Layout::On}, |
| 673 | }; |
| 674 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 675 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 676 | EXPECT_EQ(0, ledsUpdate.size()); |
| 677 | |
| 678 | // difference of refAssert and ledsAssert must be null. |
| 679 | Manager::group temp {}; |
| 680 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 681 | refAssert.begin(), refAssert.end(), |
| 682 | std::inserter(temp, temp.begin())); |
| 683 | EXPECT_EQ(0, temp.size()); |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | /** @brief Assert 2 groups having multiple LEDs common in Same State |
| 688 | * and then De-Assert One |
| 689 | */ |
| 690 | TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDAndDeAssertOne) |
| 691 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 692 | Manager manager(bus, twoGroupsWithMultiplComonLEDOn); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 693 | { |
| 694 | // Assert Set-A |
| 695 | Manager::group ledsAssert {}; |
| 696 | Manager::group ledsDeAssert {}; |
| 697 | Manager::group ledsUpdate {}; |
| 698 | |
| 699 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 700 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 701 | ledsDeAssert, ledsUpdate); |
| 702 | EXPECT_EQ(true, result); |
| 703 | |
| 704 | // Need just the ledsAssserted populated with these. |
| 705 | std::set<Layout::LedAction> refAssert = { |
| 706 | {"One",phosphor::led::Layout::On}, |
| 707 | {"Two",phosphor::led::Layout::On}, |
| 708 | {"Three",phosphor::led::Layout::On}, |
| 709 | }; |
| 710 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 711 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 712 | EXPECT_EQ(0, ledsUpdate.size()); |
| 713 | |
| 714 | // difference of refAssert and ledsAssert must be null. |
| 715 | Manager::group temp {}; |
| 716 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 717 | refAssert.begin(), refAssert.end(), |
| 718 | std::inserter(temp, temp.begin())); |
| 719 | EXPECT_EQ(0, temp.size()); |
| 720 | } |
| 721 | { |
| 722 | // Assert Set-B |
| 723 | Manager::group ledsAssert {}; |
| 724 | Manager::group ledsDeAssert {}; |
| 725 | Manager::group ledsUpdate {}; |
| 726 | |
| 727 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 728 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 729 | ledsDeAssert, ledsUpdate); |
| 730 | EXPECT_EQ(true, result); |
| 731 | |
| 732 | // Need just the ledsAssserted populated with these. |
| 733 | std::set<Layout::LedAction> refAssert = { |
| 734 | {"Six",phosphor::led::Layout::On}, |
| 735 | {"Seven",phosphor::led::Layout::On}, |
| 736 | }; |
| 737 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 738 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 739 | EXPECT_EQ(0, ledsUpdate.size()); |
| 740 | |
| 741 | // difference of refAssert and ledsAssert must be null. |
| 742 | Manager::group temp {}; |
| 743 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 744 | refAssert.begin(), refAssert.end(), |
| 745 | std::inserter(temp, temp.begin())); |
| 746 | EXPECT_EQ(0, temp.size()); |
| 747 | } |
| 748 | { |
| 749 | // DeAssert Set-A |
| 750 | Manager::group ledsAssert {}; |
| 751 | Manager::group ledsDeAssert {}; |
| 752 | Manager::group ledsUpdate {}; |
| 753 | |
| 754 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 755 | auto result = manager.setGroupState(group, false, ledsAssert, |
| 756 | ledsDeAssert, ledsUpdate); |
| 757 | EXPECT_EQ(false, result); |
| 758 | |
| 759 | // Need just the ledsAssserted populated with these. |
| 760 | std::set<Layout::LedAction> refDeAssert = { |
| 761 | {"One",phosphor::led::Layout::On}, |
| 762 | }; |
| 763 | EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size()); |
| 764 | EXPECT_EQ(0, ledsAssert.size()); |
| 765 | EXPECT_EQ(0, ledsUpdate.size()); |
| 766 | |
| 767 | // difference of refAssert and ledsAssert must be null. |
| 768 | Manager::group temp {}; |
| 769 | std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(), |
| 770 | refDeAssert.begin(), refDeAssert.end(), |
| 771 | std::inserter(temp, temp.begin())); |
| 772 | EXPECT_EQ(0, temp.size()); |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | /** @brief Assert 2 groups having multiple LEDs common but in |
| 777 | * different state and De-Assert one*/ |
| 778 | TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDeAssertOne) |
| 779 | { |
Vishwanatha Subbanna | 11ca8f9 | 2017-02-27 19:33:45 +0530 | [diff] [blame] | 780 | Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 781 | { |
| 782 | // Assert Set-B |
| 783 | Manager::group ledsAssert {}; |
| 784 | Manager::group ledsDeAssert {}; |
| 785 | Manager::group ledsUpdate {}; |
| 786 | |
| 787 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet"; |
| 788 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 789 | ledsDeAssert, ledsUpdate); |
| 790 | EXPECT_EQ(true, result); |
| 791 | |
| 792 | // Need just the ledsAssserted populated with these. |
| 793 | std::set<Layout::LedAction> refAssert = { |
| 794 | {"Two",phosphor::led::Layout::On}, |
| 795 | {"Three",phosphor::led::Layout::Blink}, |
| 796 | {"Five",phosphor::led::Layout::On}, |
| 797 | {"Six",phosphor::led::Layout::On}, |
| 798 | }; |
| 799 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 800 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 801 | EXPECT_EQ(0, ledsUpdate.size()); |
| 802 | |
| 803 | // difference of refAssert and ledsAssert must be null. |
| 804 | Manager::group temp {}; |
| 805 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 806 | refAssert.begin(), refAssert.end(), |
| 807 | std::inserter(temp, temp.begin())); |
| 808 | EXPECT_EQ(0, temp.size()); |
| 809 | } |
| 810 | { |
| 811 | // Assert Set-A |
| 812 | Manager::group ledsAssert {}; |
| 813 | Manager::group ledsDeAssert {}; |
| 814 | Manager::group ledsUpdate {}; |
| 815 | |
| 816 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 817 | auto result = manager.setGroupState(group, true, ledsAssert, |
| 818 | ledsDeAssert, ledsUpdate); |
| 819 | EXPECT_EQ(true, result); |
| 820 | |
| 821 | // Need just the ledsAssserted populated with these. |
| 822 | std::set<Layout::LedAction> refAssert = { |
| 823 | {"One",phosphor::led::Layout::On}, |
| 824 | {"Two",phosphor::led::Layout::Blink}, |
| 825 | {"Three",phosphor::led::Layout::On}, |
| 826 | {"Four",phosphor::led::Layout::On}, |
| 827 | }; |
| 828 | EXPECT_EQ(refAssert.size(), ledsAssert.size()); |
| 829 | EXPECT_EQ(0, ledsDeAssert.size()); |
| 830 | EXPECT_EQ(0, ledsUpdate.size()); |
| 831 | |
| 832 | // difference of refAssert and ledsAssert must be null. |
| 833 | Manager::group temp {}; |
| 834 | std::set_difference(ledsAssert.begin(), ledsAssert.end(), |
| 835 | refAssert.begin(), refAssert.end(), |
| 836 | std::inserter(temp, temp.begin())); |
| 837 | EXPECT_EQ(0, temp.size()); |
| 838 | } |
| 839 | { |
| 840 | // DeAssert Set-A |
| 841 | Manager::group ledsAssert {}; |
| 842 | Manager::group ledsDeAssert {}; |
| 843 | Manager::group ledsUpdate {}; |
| 844 | |
| 845 | auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet"; |
| 846 | auto result = manager.setGroupState(group, false, ledsAssert, |
| 847 | ledsDeAssert, ledsUpdate); |
| 848 | EXPECT_EQ(false, result); |
| 849 | |
| 850 | // Need just the ledsUpdated populated with these. |
| 851 | std::set<Layout::LedAction> refUpdate = { |
| 852 | {"Two",phosphor::led::Layout::On}, |
| 853 | {"Three",phosphor::led::Layout::Blink}, |
| 854 | }; |
| 855 | EXPECT_EQ(refUpdate.size(), ledsUpdate.size()); |
| 856 | EXPECT_EQ(0, ledsAssert.size()); |
| 857 | |
| 858 | // difference of refAssert and ledsAssert must be null. |
| 859 | Manager::group temp {}; |
| 860 | std::set_difference(ledsUpdate.begin(), ledsUpdate.end(), |
| 861 | refUpdate.begin(), refUpdate.end(), |
| 862 | std::inserter(temp, temp.begin())); |
| 863 | EXPECT_EQ(0, temp.size()); |
| 864 | |
| 865 | // Need just the ledsDeAsserted populated with these. |
| 866 | std::set<Layout::LedAction> refDeAssert = { |
| 867 | {"One",phosphor::led::Layout::On}, |
| 868 | {"Four",phosphor::led::Layout::On}, |
| 869 | }; |
| 870 | EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size()); |
| 871 | |
| 872 | // difference of refAssert and ledsAssert must be null. |
| 873 | temp.clear(); |
| 874 | std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(), |
| 875 | refDeAssert.begin(), refDeAssert.end(), |
| 876 | std::inserter(temp, temp.begin())); |
| 877 | EXPECT_EQ(0, temp.size()); |
| 878 | } |
| 879 | } |