Skip to content

Commit

Permalink
test encode
Browse files Browse the repository at this point in the history
  • Loading branch information
bertmelis authored Jan 13, 2025
1 parent b8af8a0 commit 2f9494a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Datapoint/ConversionHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ std::size_t decodeSchedule(const uint8_t* data, std::size_t len, char* output, s
hour = 0;
minutes = 0;
}
int result = snprintf(&output[pos], maxLen - result, "%u.02:%u.02", hour, minutes);
int result = snprintf(&output[pos], maxLen - pos, "%u.02:%u.02", hour, minutes);
if (result < 0) return 0;
pos += result;
if (i < 7) {
Expand Down
4 changes: 2 additions & 2 deletions test/test_Datapoint/test_Datapoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void test_COPEncode() {
TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, buffer, len);
}

void test_Schedule() {
void test_ScheduleEncode() {
const char* schedule = "7:30 08:30 16:20 23:10";
const uint8_t expected[] = {0x3B, 0x43, 0x82, 0xB9, 0x00, 0x00, 0x00, 0x00};
const size_t numSchedules = 2;
Expand Down Expand Up @@ -235,6 +235,6 @@ int main() {
RUN_TEST(test_CountShortEncode);
RUN_TEST(test_COPDecode);
RUN_TEST(test_COPEncode);
RUN_TEST(test_Schedule);
RUN_TEST(test_ScheduleEncode);
return UNITY_END();
}

0 comments on commit 2f9494a

Please sign in to comment.