firmware  v0.1.2
Chromation Spectrometer Dev-Kit
test_BiColorLed.c
1 #include "unity.h"
2 #include "test_BiColorLed.h"
3 #include "BiColorLed.h"
4 
5 void BiColorLedOn_sets_bit_in_ddr(void)
6 {
7  /* =====[ Setup ]===== */
8  *BiColorLed_ddr = 0xFE;
9  bicolorled_num led = 0;
10  TEST_ASSERT_BIT_LOW_MESSAGE(
11  led,
12  *BiColorLed_ddr,
13  "Cannot run test: must start with ddr led bit clear!"
14  );
15  /* =====[ Operate ]===== */
16  BiColorLedOn(led);
17  /* =====[ Test ]===== */
18  TEST_ASSERT_BIT_HIGH(led, *BiColorLed_ddr);
19 }
20 void BiColorLedOff_clears_bit_in_ddr(void)
21 {
22  /* =====[ Setup ]===== */
23  *BiColorLed_ddr = 0x01;
24  bicolorled_num led = 0;
25  TEST_ASSERT_BIT_HIGH_MESSAGE(
26  led,
27  *BiColorLed_ddr,
28  "Cannot run test: must start with ddr led bit set!"
29  );
30  /* =====[ Operate ]===== */
31  BiColorLedOff(led);
32  /* =====[ Test ]===== */
33  TEST_ASSERT_BIT_LOW(led, *BiColorLed_ddr);
34 }
35 void BiColorLedGreen_clears_bit_in_port(void)
36 {
37  /* =====[ Setup ]===== */
38  *BiColorLed_port = 0x01;
39  bicolorled_num led = 0;
40  TEST_ASSERT_BIT_HIGH_MESSAGE(
41  led,
42  *BiColorLed_port,
43  "Cannot run test: must start with port led bit set!"
44  );
45  /* =====[ Operate ]===== */
46  BiColorLedGreen(led);
47  /* =====[ Test ]===== */
48  TEST_ASSERT_BIT_LOW(led, *BiColorLed_port);
49 }
50 void BiColorLedRed_sets_bit_in_port(void)
51 {
52  /* =====[ Setup ]===== */
53  *BiColorLed_port = 0x00;
54  bicolorled_num led = 0;
55  TEST_ASSERT_BIT_LOW_MESSAGE(
56  led,
57  *BiColorLed_port,
58  "Cannot run test: must start with port led bit clear!"
59  );
60  /* =====[ Operate ]===== */
61  BiColorLedRed(led);
62  /* =====[ Test ]===== */
63  TEST_ASSERT_BIT_HIGH(led, *BiColorLed_port);
64 }
void BiColorLedOff(bicolorled_num led)
Definition: BiColorLed.h:28
void BiColorLedGreen(bicolorled_num led)
Definition: BiColorLed.h:35
void BiColorLedRed(bicolorled_num led)
Definition: BiColorLed.h:42
void BiColorLedOn(bicolorled_num led)
Definition: BiColorLed.h:21
uint8_t const bicolorled_num
Indicator LED numbers in the JSON file are not necessarily the same as the corresponding bit number i...
Definition: BiColorLed.h:10