Skip to content

Commit

Permalink
test decode
Browse files Browse the repository at this point in the history
  • Loading branch information
bertmelis authored Jan 13, 2025
1 parent 2f9494a commit 32d625b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test_Datapoint/test_Datapoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ void test_ScheduleEncode() {
TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, buffer, len);
}

void test_ScheduleDecode() {
const uint8_t data[] = {0x3B, 0x43, 0x82, 0xB9, 0x00, 0x00, 0x00, 0x00};
const std::size_t len = 8;
const char* expected = "07:30 08:30 16:20 23:10 00:00 00:00 00:00 00:00";
const std::size_t bufferLen = 48;
char buffer[bufferLen];

std::size_t result = VitoWiFi::decodeSchedule(data, len, buffer, bufferLen);

TEST_ASSERT_EQUAL(bufferLen, result);
TEST_ASSERT_EQUAL_STRING_LEN(expected, buffer, bufferLen)
}

int main() {
UNITY_BEGIN();
RUN_TEST(test_Converter);
Expand All @@ -236,5 +249,6 @@ int main() {
RUN_TEST(test_COPDecode);
RUN_TEST(test_COPEncode);
RUN_TEST(test_ScheduleEncode);
RUN_TEST(test_ScheduleDecode);
return UNITY_END();
}

0 comments on commit 32d625b

Please sign in to comment.