Skip to content

Commit

Permalink
tests/unit-test-client.c: fix regression, save slave address for next…
Browse files Browse the repository at this point in the history
… tests before testing for quirks
  • Loading branch information
viktor-av committed May 21, 2020
1 parent 569df9f commit f8551fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/unit-test-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,16 @@ int main(int argc, char *argv[])
rc = modbus_set_slave(ctx, 248);
ASSERT_TRUE(rc == -1, "Slave address must not be allowed");

/* Save slave address for next tests before testing for quirks */
old_slave = modbus_get_slave(ctx);

printf("2/2 Not compliant slave address allowed: ");
modbus_enable_quirks(ctx, MODBUS_QUIRK_INVAL_ADDR);
rc = modbus_set_slave(ctx, 248);
ASSERT_TRUE(rc == 0, "Not compliant slave address refused");
modbus_disable_quirks(ctx, MODBUS_QUIRK_INVAL_ADDR);

/** SLAVE REPLY **/
old_slave = modbus_get_slave(ctx);

printf("\nTEST SLAVE REPLY:\n");

rc = modbus_set_slave(ctx, INVALID_SERVER_ID);
Expand Down

0 comments on commit f8551fb

Please sign in to comment.