From 04275e06d2aab6a5e13807e0a295d3b48a979118 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Fri, 25 May 2018 13:04:39 +0930 Subject: test: physical: Cover trigger:none, brigtness:asserted branch The test causes execution to take the following path in setInitialState(), previously outlined in 264d909d3dc9 ("test: Add tests for Physical class") as being missed: auto brightness = led.getBrightness(); if (brightness == ASSERT) { // LED is in Solid ON sdbusplus::xyz::openbmc_project::Led::server ::Physical::state( Action::On); } This brings the line coverage to 97.6% (function coverage remains unchanged by this patch). Change-Id: I7a04fcd97819559575e69d267c62f16195495010 Signed-off-by: Andrew Jeffery --- test/physical.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/physical.cpp') diff --git a/test/physical.cpp b/test/physical.cpp index 897a43f..9312598 100644 --- a/test/physical.cpp +++ b/test/physical.cpp @@ -115,3 +115,13 @@ TEST(Physical, blink) phosphor::led::Physical phy(bus, LED_OBJ, led); phy.state(Action::Blink); } + +TEST(Physical, ctor_none_trigger_asserted_brightness) +{ + sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); + NiceMock led; + EXPECT_CALL(led, getTrigger()).WillRepeatedly(Return("none")); + constexpr auto val = phosphor::led::ASSERT; + EXPECT_CALL(led, getBrightness()).WillRepeatedly(Return(val)); + phosphor::led::Physical phy(bus, LED_OBJ, led); +} -- cgit v1.2.1