Skip to content

Commit ab4a66c

Browse files
committed
Encode expectations for value of "id" in unit test.
1 parent ba86aef commit ab4a66c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/src/CanMsg/test_CanMsg.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ TEST_CASE ("Test constructor with data (data length > CanMsg::MAX_DATA_LENGTH)",
5050
for (size_t i = 0; i < msg.data_length; i++)
5151
REQUIRE(msg.data[i] == msg_data[i]);
5252
}
53+
54+
TEST_CASE ("Test constructor constructing a CAN frame with standard ID", "[CanMsg-CanMsg-04]")
55+
{
56+
CanMsg const msg(CanStandardId(0x20), 0, nullptr);
57+
58+
REQUIRE(msg.id == 0x20);
59+
}
60+
61+
TEST_CASE ("Test constructor constructing a CAN frame with extended ID", "[CanMsg-CanMsg-05]")
62+
{
63+
CanMsg const msg(CanExtendedId(0x20), 0, nullptr);
64+
65+
REQUIRE(msg.id == (CanMsg::CAN_EFF_FLAG | 0x20));
66+
}

0 commit comments

Comments
 (0)