TEST_F(LedDriver, OutOfBoundsChangesNothing) { LedDriver_TurnOn(-1); LedDriver_TurnOn(0); LedDriver_TurnOn(17); LedDriver_TurnOn(3141); ASSERT_EQ(0, virtualLeds); }
int main() { uint16_t ledsAddress; LedDriver_Create(&ledsAddress); LedDriver_TurnAllOff(); LedDriver_TurnOn(3); LedDriver_Destroy(); return 0; }
TEST_F(LedDriver, OutOfBoundsProducesRuntimeError) { LedDriver_TurnOn(-1); ASSERT_STREQ("LedDriver: out-of-bounds LED", RuntimeErrorStub_GetLastError()); ASSERT_EQ(-1, RuntimeErrorStub_GetLastParameter()); }
TEST_F(LedDriver, UpperAndLowerBounds) { LedDriver_TurnOn(1); LedDriver_TurnOn(16); ASSERT_EQ(0x8001, virtualLeds); }
TEST_F(LedDriver, LedMemoryIsNotReadable) { virtualLeds = 0xffff; LedDriver_TurnOn(8); ASSERT_EQ(0x80, virtualLeds); }
TEST_F(LedDriver, TurnOnMultipleLeds) { LedDriver_TurnOn(9); LedDriver_TurnOn(8); ASSERT_EQ(0x0180, virtualLeds); }
TEST_F(LedDriver, TurnOffLedOne) { LedDriver_TurnOn(1); LedDriver_TurnOff(1); ASSERT_EQ(0, virtualLeds); }
TEST_F(LedDriver, TurnOnLedOne) { LedDriver_TurnOn(1); ASSERT_EQ(1, virtualLeds); }
TEST_F(LedDriver, IsOff) { ASSERT_TRUE(LedDriver_IsOff(12)); LedDriver_TurnOn(12); ASSERT_FALSE(LedDriver_IsOff(12)); }
TEST_F(LedDriver, IsOn) { ASSERT_FALSE(LedDriver_IsOn(11)); LedDriver_TurnOn(11); ASSERT_TRUE(LedDriver_IsOn(11)); }