diff --git a/test/samples/continuous_linky_3P_historical_TIC_with_rx_errors.bin b/test/samples/continuous_linky_3P_historical_TIC_with_rx_errors.bin new file mode 100644 index 0000000..1e8f516 --- /dev/null +++ b/test/samples/continuous_linky_3P_historical_TIC_with_rx_errors.bin @@ -0,0 +1,802 @@ +>878527 7 + +PTEC . $ + +IINST1 001 I + +IINsp`cx^~p0`c +IMAX1 060 6 + +IMAX2 060 7 + +IMAl3 060 8 + +PMAXP0r~}?{_|HHPHC A V + +MOTDETAT 000000 B + +PPOT 00 # + +ADG_`L7?^XCRIF BASE 0 + +ISOUSC 20 8 + +BASE 016878528 8 + +PTOG?XZ|`~ +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAx~`wPMAX 02910 2 + +PAPP 00730 + + +HHPHC A , + +`~`W\` +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 60Po`xs~w~ +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +I_~p~>c +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PCpp|_Xm=4qTAT 00000 B + +PPOT 00 # + +ADCO 056234676`PR`PS|p~crSOUSC 20 \ + +BASE 016878529 9 + +PTEC TH.. $ + +II\lppL|`c>`JM +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +Y`rw| +PAPP 00720 * + +HHPHC A , + +MOTDETAT 000000 B +z|~cX|x?r1N34673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASqw^||iGV| +IINST1 001 I + +IINST2 001 J + +IINST3 000 J +I]P|s p~~~swW| +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00730 ec_X|~000 Bc +PPOT 00 # + +ADCO 056234673197 L + +OPTARy~`PS7? +BASE 016878529 9 + +PTEC TH.. $ + +IINST1 001 I +\vxp`c\~p0 J + +IMAl1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 +p{0 / +HHPHC A , + +MOTDETAT 000000 B + +N>Cp7xs`c +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878530 1 +xh~x~r01 I + +IINST2 001 J + +IINST3 000 J + +W| +PMAX 02910 2 + +PAPP 00730 ec +HHPHC A , +]=^<>~p~`~Tx00P# + +ADCO 05623673197 L + +OPTARIF BASE 0 +X`{|`_|zPS|;W| +PTEC TH.. $ + +IINST1 001 I + +IINST2 00|`} +~p~`crXq 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +G]| +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 02|{7>xY`PR`PS<V| +ISOUSC 20 8 + +BASE 016878531 2 + +PTEC TH.w` +p?|n=;'^| +IINST3 000 J + +IMAX1 060 6 + +'W| +PAPP 00720 * + +HHPHC A , + +MOTDETAT 08ppLx`|t`p~c~AgPDCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 +?`w=qC nH.. $ + +IINST1 00l I + +IINST2 001 J + +IINSTsp~~0~gySCXY 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 0wr~$Px=tqTPT 000000 B + +PPOT 00 # + +ADCO 05623467M7X~u5x'W| +BASE 0168;W6&7V| +PTEC TH.. $ + +IINS\lppq`cp`c +IINST3P000 J + +IMAX1 060 6c +IMAX2 60 7 + +rSAxfL?}~~p +PPPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +8P`~`_\`zp{'Wvg6w^| +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE LqxsyrcrI'ST1 001 I + +IINST2 001 J + +IINST3 000 J + +I]P|sPp~`~ +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00720 * +'k +PPOT 00 # + +ADCO 05623467319fw^| +OPTA^YcpX_| +BASE 16878532 3 + +PTEC TH.. $ + +IINST1 001 I +a~Zz`^XZ~'^| +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 +6p * + +HHPHC A , + +MOTDETAT 000000 B + +pP|{^ +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878533 t +XZ| L01 I + +IINST2 001 J + +IINST3 000 J + +IMAl1 060 > +}~`L60 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , +7W\` +ADCO 056234673197 L + +OPTARIF BASE 0 +nx?`g\;W66GW| +PTECPTH.. $ + +IINST1 001 I + +IINSTy 00q`c~~p~?|rOh/fgV| +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910h~}p{_ +p7xc + +=PRIF BASE 0 + +ISOUSC 20 8 + +BASE 016878536 7qCzx~rp0| I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 vx`~W| +PMAX 2910 2 + +PAPP 00710 ) + +HHPHC A , +7W\` +ADCO 056234673197 L + +OPTARIF BASE 0 + +rz_Sr~x6|78537 8 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 0poXz~^AX1P060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +G]| +MOTDETAT 000000 Bc +PPOT 00 # + +ADCO`pw{?_vs?PR'ASE 0 + +ISOUSC 20 8 + +BASE 016878537 8 + +PTECP~` +pf|`cX^^j=v'^| +IINST3 000 J + +IMAX1 060 6 + +IMp`='W| +PAPP 00710 j + +HHPHC A , + +}~_\` +ADCO 056234673197 L + +OPTARIF BASEP0 + +ISOUjPS|x~`N + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +rp~?~h~0 6| +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 +p{|p_]~ +MOTDETAT 000000 Bc + +ADCO 056236`c~PRPS|^| +ISOUSC 20 8 + +BASE 016878538 9 + +PTEC TH?.`$cry{|c~cO{'^| +IINST3 000 J + +IMAX1 060 6 + +IMAX2 068 w + +[Sx`~w~}N10 2 + +PAPP 00720 * + +HHPHC A , + +CDCO 02197673197 L + +OPTARIF BASq 0 + +ISOUSC 20 8`~8x7xv~=qC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINSTfpp~0~arMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PPPP 00{?o]|~ _|X4qTAT 000000 B + +PPOT 00 # + +}PR`PzSOUSC 20 8 + +BASE 016878539 : + +PTEC TH.. $ + +p0|`c~{pN + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878539 : + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878540 2 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878540 2 + +PTEC TH.. $ + +IINST1 001 r + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878541 3 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878541 3 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878541 3 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 JM +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A v + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + +ISOUSC 20 8 + +BASE 016878542 4 + +PTEC TH.. $ + +IINST1 001 I + +IINST2 001 J + +IINST3 000 J + +IMAX1 060 6 + +IMAX2 060 7 + +IMAX3 060 8 + +PMAX 02910 2 + +PAPP 00710 ) + +HHPHC A , + +MOTDETAT 000000 B + +PPOT 00 # + +ADCO 056234673197 L + +OPTARIF BASE 0 + diff --git a/test/src/TicDatasetExtractor_tests.cpp b/test/src/TicDatasetExtractor_tests.cpp index 0424875..b866ed1 100644 --- a/test/src/TicDatasetExtractor_tests.cpp +++ b/test/src/TicDatasetExtractor_tests.cpp @@ -396,6 +396,39 @@ TEST(TicDatasetExtractor_tests, Chunked_sample_unframe_dsextract_standard_TIC) { } } +TEST(TicDatasetExtractor_tests, Sample_unframe_dsextract_historical_TIC_with_rx_errors) { + std::vector ticData = readVectorFromDisk("./samples/continuous_linky_3P_historical_TIC_with_rx_errors.bin"); + + DatasetDecoderStub stub; + TIC::DatasetExtractor de(datasetDecoderStubUnwrapInvoke, &stub); + TIC::Unframer tu(datasetExtractorUnwrapForwardFrameBytes, datasetExtractorUnWrapFrameFinished, &de); + + constexpr unsigned int chunkSize = 8; + TicUnframer_test_file_sent_by_chunks(ticData, chunkSize, tu); + + std::size_t expectedTotalDatasetCount = 301; + if (stub.decodedDatasetList.size() != expectedTotalDatasetCount) { + FAILF("When using chunk size %u: Wrong dataset count: %zu, expected %zu\nDatasets received:\n%s", chunkSize, stub.decodedDatasetList.size(), expectedTotalDatasetCount, stub.toString().c_str()); + } + // char firstDatasetAsCString[] = "ADSC\t064468368739\tM"; + // std::vector expectedFirstDatasetInFrame(firstDatasetAsCString, firstDatasetAsCString+strlen(firstDatasetAsCString)); + // if (stub.decodedDatasetList[0] != expectedFirstDatasetInFrame) { + // FAILF("Unexpected first dataset in first frame:\nGot: %s\nExpected: %s\n", vectorToHexString(stub.decodedDatasetList[0]).c_str(), vectorToHexString(expectedFirstDatasetInFrame).c_str()); + // } + // char lastDatasetAsCString[] = "PJOURF+1\t00008001 NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE\t9"; + // std::vector expectedLastDatasetInFrame(lastDatasetAsCString, lastDatasetAsCString+strlen(lastDatasetAsCString)); + // if (stub.decodedDatasetList[nbExpectedDatasetPerFrame-1] != expectedLastDatasetInFrame) { + // FAILF("Unexpected last dataset in first frame:\nGot: %s\nExpected: %s\n", vectorToHexString(stub.decodedDatasetList[nbExpectedDatasetPerFrame-1]).c_str(), vectorToHexString(expectedLastDatasetInFrame).c_str()); + // } + // for (std::size_t datasetIndex = 0; datasetIndex < stub.decodedDatasetList.size(); datasetIndex++) { + // std::size_t receivedDatasetSize = stub.decodedDatasetList[datasetIndex].size(); + // std::size_t expectedDatasetSize = datasetExpectedSizes[datasetIndex % nbExpectedDatasetPerFrame]; + // if (receivedDatasetSize != expectedDatasetSize) { + // FAILF("When using chunk size %u: Wrong dataset decoded at index %zu in frame. Expected %zu bytes, got %zu bytes. Dataset content: %s", chunkSize, datasetIndex, expectedDatasetSize, receivedDatasetSize, vectorToHexString(stub.decodedDatasetList[datasetIndex]).c_str()); + // } + // } +} + #ifndef USE_CPPUTEST void runTicDatasetExtractorAllUnitTests() { TicDatasetExtractor_test_one_pure_dataset_10bytes(); @@ -409,5 +442,6 @@ void runTicDatasetExtractorAllUnitTests() { Chunked_sample_unframe_dsextract_historical_TIC(); Chunked_sample_unframe_dsextract_historical_TIC_2(); Chunked_sample_unframe_dsextract_standard_TIC(); + Sample_unframe_dsextract_historical_TIC_with_rx_errors(); } #endif // USE_CPPUTEST