Skip to content

Commit b8ca44b

Browse files
Added unit test for decoding SDSM data
1 parent 0511993 commit b8ca44b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

data/InputData.decoding.sdsm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<OdeAsn1Data><metadata><bsmSource>RV</bsmSource><logFileName/><recordType>bsmTx</recordType><securityResultCode>success</securityResultCode><receivedMessageDetails><locationData><latitude/><longitude/><elevation/><speed/><heading/></locationData><rxSource>RV</rxSource></receivedMessageDetails><encodings><encodings><elementName>unsecuredData</elementName><elementType>MessageFrame</elementType><encodingRule>UPER</encodingRule></encodings></encodings><payloadType>us.dot.its.jpo.ode.model.OdeAsn1Payload</payloadType><serialId><streamId>bee2fd4f-f2e4-4a91-a35c-dabf83f22dec</streamId><bundleSize>1</bundleSize><bundleId>0</bundleId><recordId>0</recordId><serialNumber>0</serialNumber></serialId><odeReceivedAt>2023-02-21T21:08:03.588646Z</odeReceivedAt><schemaVersion>6</schemaVersion><maxDurationTime>0</maxDurationTime><recordGeneratedAt/><recordGeneratedBy/><sanitized>false</sanitized><odePacketID/><odeTimStartDateTime/><originIp>10.10.10.10</originIp></metadata><payload><dataType>us.dot.its.jpo.ode.model.OdeHexByteArray</dataType><data><bytes>002980D2984F4354453FF9A28C697824864A6AF5C188341D5DAB735466211455E077F03AF4540F459C2C368C0B15BBEA0717556DB5FAF126C51E90F5D03FF009F8A09C8DD4AE3FAA9F6D9A1B012649C2D1A37BFA92619453C7E7381499F89FAB97F2DB2047D936E197C23E3BD1041FF90030D6010DADA252A6D772ACFD0E85D0C0DACB15FD2A57B384A2E341228F361616C45FDFC83473D2ADEA222FCF1FA556632B24794D7F2A55C9A3A0BD136D402EC7ECD733E96CDDEF7238D73FC843771503FF1026288DB507EBA2A438F213B7EAC7FBBEB5ACC7</bytes></data></payload></OdeAsn1Data>

src/tests.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,18 @@ TEST_CASE("Decode VehicleEventFlags with unknown future extension, from UPER to
390390
std::cout << "=== Decode VehicleEventFlags with unknown future extension, from UPER to struct, 15 bits ===" << std::endl;
391391
test_decode_VehicleEventFlags_from_uper(uper_15bits, 3, bitstring_15bits, 1);
392392
}
393+
394+
// test case for decoding SDSM from uper
395+
TEST_CASE("Decode SDSM from UPER", "[decoding]") {
396+
std::cout << "=== Decode SDSM from UPER ===" << std::endl;
397+
398+
// prepare
399+
asn1_codec.setup_logger_for_testing();
400+
401+
std::stringstream out9;
402+
CHECK(asn1_codec.file_test("data/InputData.decoding.sdsm.xml", out9, false) == EXIT_SUCCESS);
403+
parse_result = output_doc.load(out9, pugi::parse_default | pugi::parse_declaration | pugi::parse_doctype | pugi::parse_trim_pcdata);
404+
CHECK(parse_result);
405+
payload_node = ode_payload_query.evaluate_node(output_doc).node();
406+
CHECK(payload_node);
407+
}

0 commit comments

Comments
 (0)