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

  1. #include "unity_fixture.h"
  2. #include "../src/LedDriver.h"
  3. TEST_GROUP(LedDriver);
  4. static uint16_t virtualLeds;
  5. TEST_SETUP(LedDriver) {
  6. LedDriver_Create(&virtualLeds);
  7. }
  8. TEST_TEAR_DOWN(LedDriver) {
  9. }
  10. TEST(LedDriver, LedsOffAfterCreate) {
  11. uint16_t virtualLeds = 0xFFFF;
  12. LedDriver_Create(&virtualLeds);
  13. TEST_ASSERT_EQUAL_HEX16(0x0000, virtualLeds);
  14. }
  15. TEST(LedDriver, TurnOnLedOne) {
  16. LedDriver_TurnOn(1);
  17. TEST_ASSERT_EQUAL_HEX16(0x0001, virtualLeds);
  18. }
  19. TEST(LedDriver, TurnOffLedOne) {
  20. LedDriver_TurnOn(1);
  21. LedDriver_TurnOff(1);
  22. TEST_ASSERT_EQUAL_HEX16(0x0000, virtualLeds);
  23. }
  24. TEST(LedDriver, TurnOnMultipleLeds) {
  25. LedDriver_TurnOn(8);
  26. LedDriver_TurnOn(9);
  27. TEST_ASSERT_EQUAL_HEX16(0x0180, virtualLeds);
  28. }