Skip to content

Commit 4170817

Browse files
Fix unit tests: add missing break; and better messages.
1 parent 22bbe09 commit 4170817

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/modbus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ static int check_confirmation(modbus_t *ctx, uint8_t *req, uint8_t *rsp, int rsp
685685
case MODBUS_FC_WRITE_FILE_RECORD:
686686
req_nb_value = (req[offset + 7] << 8) + req[offset + 8];
687687
rsp_nb_value = (rsp[offset + 7] << 8) + rsp[offset + 8];
688+
break;
688689
case MODBUS_FC_WRITE_SINGLE_COIL:
689690
case MODBUS_FC_WRITE_SINGLE_REGISTER:
690691
/* address in request and response must be equal */

tests/unit-test-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ int main(int argc, char *argv[])
335335
rc = modbus_write_file_record(ctx, UT_FILE, UT_RECORD_ADDRESS,
336336
UT_REGISTERS_NB, UT_REGISTERS_TAB);
337337
printf("3/6 modbus_write_file_record: ");
338-
ASSERT_TRUE(rc == UT_REGISTERS_NB, "FAILED (nb points %d)\n", rc);
338+
ASSERT_TRUE(rc == UT_REGISTERS_NB, "FAILED (nb records written %d)\n", rc);
339339
/* Write four more records to file 1 on server, starting at record 5,
340340
* i.e. after previous records */
341341
nb_points = UT_RECORD_ADDRESS + UT_REGISTERS_NB;
342342
rc = modbus_write_file_record(ctx, UT_FILE, nb_points,
343343
UT_FILE_RECORD_NB, UT_FILE_TAB);
344344
printf("4/6 modbus_write_file_record: ");
345-
ASSERT_TRUE(rc == UT_FILE_RECORD_NB, "FAILED (nb points %d)\n", rc);
345+
ASSERT_TRUE(rc == UT_FILE_RECORD_NB, "FAILED (nb records written %d)\n", rc);
346346

347347
/* Read back all 7 records and make sure the values are correct.
348348
* Allocate and initialize the memory to store the registers as we need more.

0 commit comments

Comments
 (0)