@@ -233,7 +233,7 @@ PTF_TEST_CASE(SomeIpTpParsingTest)
233
233
PTF_ASSERT_EQUAL (someIpTpLayer2->getMessageType (), pcpp::SomeIpLayer::MsgType::TP_REQUEST_NO_RETURN, enumclass);
234
234
PTF_ASSERT_EQUAL (someIpTpLayer2->getMessageTypeAsInt (), (uint8_t )pcpp::SomeIpLayer::MsgType::TP_REQUEST_NO_RETURN);
235
235
PTF_ASSERT_EQUAL (someIpTpLayer2->getReturnCode (), 0 );
236
- PTF_ASSERT_EQUAL (someIpTpLayer2->getOffset () * 16 , 91872 );
236
+ PTF_ASSERT_EQUAL (someIpTpLayer2->getOffset (), 91872 );
237
237
PTF_ASSERT_FALSE (someIpTpLayer2->getMoreSegmentsFlag ());
238
238
PTF_ASSERT_EQUAL (someIpTpLayer2->getPduPayloadSize (), 225 );
239
239
PTF_ASSERT_EQUAL (someIpTpLayer2->getPduPayload ()[0 ], 0xab );
@@ -284,8 +284,8 @@ PTF_TEST_CASE(SomeIpTpCreationTest)
284
284
pcpp::EthLayer ethLayer2 (ethLayer1);
285
285
pcpp::IPv4Layer ipLayer2 (ipLayer1);
286
286
pcpp::UdpLayer udpLayer2 (udpLayer1);
287
- pcpp::SomeIpTpLayer someIpTpLayer2 (0xd05f , 0x8001 , 0 , 0 , 1 , pcpp::SomeIpLayer::MsgType::REQUEST_NO_RETURN, 0 ,
288
- 91872 / 16 , false , data2, dataLen2);
287
+ pcpp::SomeIpTpLayer someIpTpLayer2 (0xd05f , 0x8001 , 0 , 0 , 1 , pcpp::SomeIpLayer::MsgType::REQUEST_NO_RETURN, 0 , 91872 ,
288
+ false , data2, dataLen2);
289
289
290
290
pcpp::Packet someIpTpPacket2 (500 );
291
291
PTF_ASSERT_TRUE (someIpTpPacket2.addLayer (ðLayer2));
@@ -306,15 +306,18 @@ PTF_TEST_CASE(SomeIpTpEditTest)
306
306
const size_t dataLen2 = 225 ;
307
307
uint8_t data2[dataLen2] = { 0 };
308
308
309
- pcpp::SomeIpTpLayer someIpTpLayer (0x6059 , 0x410c , 0x3 , 0xa , 0x5 , pcpp::SomeIpLayer::MsgType::REQUEST, 0 , 91872 / 16 ,
309
+ pcpp::SomeIpTpLayer someIpTpLayer (0x6059 , 0x410c , 0x3 , 0xa , 0x5 , pcpp::SomeIpLayer::MsgType::REQUEST, 0 , 91872 ,
310
310
true , data2, dataLen2);
311
- someIpTpLayer.setOffset (123 );
311
+ someIpTpLayer.setOffset (1968 );
312
312
313
- PTF_ASSERT_EQUAL (someIpTpLayer.getOffset (), 123 );
313
+ PTF_ASSERT_EQUAL (someIpTpLayer.getOffset (), 1968 );
314
314
PTF_ASSERT_TRUE (someIpTpLayer.getMoreSegmentsFlag ());
315
315
316
316
someIpTpLayer.setMoreSegmentsFlag (false );
317
317
318
- PTF_ASSERT_EQUAL (someIpTpLayer.getOffset (), 123 );
318
+ PTF_ASSERT_EQUAL (someIpTpLayer.getOffset (), 1968 );
319
319
PTF_ASSERT_FALSE (someIpTpLayer.getMoreSegmentsFlag ());
320
+
321
+ PTF_ASSERT_RAISES (someIpTpLayer.setOffset (17 ), std::invalid_argument,
322
+ " Invalid offset - should be a multiple of 16" );
320
323
}
0 commit comments