File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -162,3 +162,20 @@ TEST_CASE("Parse Message with non byte aligned values") {
162162 REQUIRE (Catch::Approx (result_values.at (2 )) == 76 );
163163 REQUIRE (Catch::Approx (result_values.at (3 )) == -125 );
164164}
165+
166+ TEST_CASE (" Parse Message data length < 8 unsigned" ) {
167+ const auto * filename = std::tmpnam (NULL );
168+ create_tmp_dbc_with (filename, R"( BO_ 234 MSG1: 8 Vector__XXX
169+ SG_ Msg1Sig1 : 7|8@0+ (1,0) [-3276.8|-3276.7] "C" Vector__XXX
170+ SG_ Msg1Sig2 : 15|8@0+ (1,0) [-3276.8|-3276.7] "km/h" Vector__XXX)" );
171+
172+ libdbc::DbcParser p;
173+ p.parse_file (filename);
174+
175+ std::vector<uint8_t > data{0x1 , 0x2 };
176+ std::vector<double > result_values;
177+ REQUIRE (p.parseMessage (234 , data, result_values) == libdbc::Message::ParseSignalsStatus::Success);
178+ REQUIRE (result_values.size () == 2 );
179+ REQUIRE (Catch::Approx (result_values.at (0 )) == 0x1 );
180+ REQUIRE (Catch::Approx (result_values.at (1 )) == 0x2 );
181+ }
You can’t perform that action at this time.
0 commit comments