18 static void setUp(
void) {
25 static void tearDown(
void) {
30 static void test_SaveCurrentClock(
void) {
37 static void test_GetStatusPass(
void) {
41 static void test_ConvertToBCDUnitsOnly(
void) {
42 TEST_ASSERT_EQUAL_HEX8(0b00000010, sut->ConvertToBCD(2));
45 static void test_ConvertToBCDTensOnly(
void) {
46 TEST_ASSERT_EQUAL_HEX8(0b01010000, sut->ConvertToBCD(50));
49 static void test_ConvertToBCDBothUnitsAndTens(
void) {
50 TEST_ASSERT_EQUAL_HEX8(0b01001001, sut->ConvertToBCD(49));
53 static void test_ConvertFromBCDUnitsOnly(
void) {
54 TEST_ASSERT_EQUAL_INT(2, sut->ConvertFromBCD(0b00000010));
57 static void test_ConvertFromBCDTensOnly(
void) {
58 TEST_ASSERT_EQUAL_INT(50, sut->ConvertFromBCD(0b01010000));
61 static void test_ConvertFromBCDUnitsAndTens(
void) {
62 TEST_ASSERT_EQUAL_INT(49, sut->ConvertFromBCD(0b01001001));
65 static void test_SetGetClock(
void) {
67 int clock[] = {12, 1, 24, 13, 59, 12, 4};
69 TEST_ASSERT_TRUE(sut->
SetClock(clock[0], clock[1], clock[2], clock[3], clock[4], clock[5], clock[6]));
70 TEST_ASSERT_TRUE(sut->
GetClock(result[0], result[1], result[2], result[3], result[4], result[5], result[6]));
72 TEST_ASSERT_EQUAL_INT_ARRAY(clock, result, 7);
76 static void test_SetGetClockNoWeekday(
void) {
78 int clock[] = {12, 1, 24, 13, 59, 12};
80 TEST_ASSERT_TRUE(sut->
SetClock(clock[0], clock[1], clock[2], clock[3], clock[4], clock[5]));
81 TEST_ASSERT_TRUE(sut->
GetClock(result[0], result[1], result[2], result[3], result[4], result[5]));
83 TEST_ASSERT_EQUAL_INT_ARRAY(clock, result, 6);
88 static void test_ClockCountsSeconds(
void) {
89 int clock[] = {12, 1, 24, 13, 59, 12};
91 TEST_ASSERT_TRUE(sut->
SetClock(clock[0], clock[1], clock[2], clock[3], clock[4], clock[5]));
93 const int secondsDelay = 2;
94 waitcnt(CLKFREQ * secondsDelay + CNT);
95 clock[5] += secondsDelay;
96 TEST_ASSERT_TRUE(sut->
GetClock(result[0], result[1], result[2], result[3], result[4], result[5]));
97 TEST_ASSERT_EQUAL_INT_ARRAY(clock, result, 6);
102 static void test_RestoreCurrentClock(
void) {
107 static void test_GetStatusIsFalseForNoBus(
void) {