Andrew Jeffery | a607a0d | 2018-05-23 16:15:26 +0930 | [diff] [blame] | 1 | #include "physical.hpp" |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | |
| 5 | #include <gtest/gtest.h> |
| 6 | |
| 7 | constexpr auto LED_OBJ = "/foo/bar/led"; |
| 8 | constexpr auto LED_SYSFS = "/sys/class/leds/test"; |
| 9 | |
| 10 | using Action = sdbusplus::xyz::openbmc_project::Led::server::Physical::Action; |
| 11 | |
| 12 | TEST(Physical, ctor) |
| 13 | { |
| 14 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 15 | phosphor::led::Physical led(bus, LED_OBJ, LED_SYSFS); |
| 16 | } |
| 17 | |
| 18 | TEST(Physical, off) |
| 19 | { |
| 20 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 21 | phosphor::led::Physical led(bus, LED_OBJ, LED_SYSFS); |
| 22 | led.state(Action::Off); |
| 23 | } |
| 24 | |
| 25 | TEST(Physical, on) |
| 26 | { |
| 27 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 28 | phosphor::led::Physical led(bus, LED_OBJ, LED_SYSFS); |
| 29 | led.state(Action::On); |
| 30 | } |
| 31 | |
| 32 | TEST(Physical, blink) |
| 33 | { |
| 34 | sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); |
| 35 | phosphor::led::Physical led(bus, LED_OBJ, LED_SYSFS); |
| 36 | led.state(Action::Blink); |
| 37 | } |