Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
751 B

#include "unity_fixture.h"
#include "../src/LedDriver.h"
TEST_GROUP(LedDriver);
static uint16_t virtualLeds;
TEST_SETUP(LedDriver) {
LedDriver_Create(&virtualLeds);
}
TEST_TEAR_DOWN(LedDriver) {
}
TEST(LedDriver, LedsOffAfterCreate) {
uint16_t virtualLeds = 0xFFFF;
LedDriver_Create(&virtualLeds);
TEST_ASSERT_EQUAL_HEX16(0x0000, virtualLeds);
}
TEST(LedDriver, TurnOnLedOne) {
LedDriver_TurnOn(1);
TEST_ASSERT_EQUAL_HEX16(0x0001, virtualLeds);
}
TEST(LedDriver, TurnOffLedOne) {
LedDriver_TurnOn(1);
LedDriver_TurnOff(1);
TEST_ASSERT_EQUAL_HEX16(0x0000, virtualLeds);
}
TEST(LedDriver, TurnOnMultipleLeds) {
LedDriver_TurnOn(8);
LedDriver_TurnOn(9);
TEST_ASSERT_EQUAL_HEX16(0x0180, virtualLeds);
}