@@ -100,8 +100,8 @@ void test_ok_writeresponse() {
100
100
0x02 , // flags: id + function code (0 + write)
101
101
0x23 , // address 1
102
102
0x23 , // address 2
103
- 0x01 , // payload length
104
- 0x4F // cs
103
+ 0x02 , // payload length
104
+ 0x50 // cs
105
105
};
106
106
const std::size_t length = 8 ;
107
107
const std::size_t packetLength = 6 ;
@@ -116,6 +116,11 @@ void test_ok_writeresponse() {
116
116
}
117
117
}
118
118
119
+ // inject data into packet
120
+ const uint8_t data[2 ] = {0x01 , 0x02 };
121
+ TEST_ASSERT (_parser.packet ().setLength (_parser.packet ().length () + _parser.packet ().dataLength ()));
122
+ std::memcpy (&_parser.packet ()[VS2_DATA], data, _parser.packet ().dataLength ());
123
+
119
124
TEST_ASSERT_EQUAL (ParserResult::COMPLETE, result);
120
125
TEST_ASSERT_EQUAL_UINT (length, bytesRead);
121
126
TEST_ASSERT_EQUAL_UINT8 (packetLength, parser.packet ().length ());
@@ -124,7 +129,7 @@ void test_ok_writeresponse() {
124
129
TEST_ASSERT_EQUAL_UINT8 (FunctionCode::WRITE, parser.packet ().functionCode ());
125
130
TEST_ASSERT_EQUAL_UINT16 (0x2323 , parser.packet ().address ());
126
131
TEST_ASSERT_EQUAL_UINT8 (0x01 , parser.packet ().dataLength ());
127
- TEST_ASSERT_NULL ( parser.packet ().data ());
132
+ TEST_ASSERT_EQUAL_UINT8_ARRAY (data, parser.packet ().data (), 2 );
128
133
}
129
134
130
135
void test_spuriousbytes () {
0 commit comments