@@ -173,3 +173,39 @@ TEST_CASE("Parse Message data length < 8 unsigned") {
173173 REQUIRE (Catch::Approx (result_values.at (0 )) == 0x1 );
174174 REQUIRE (Catch::Approx (result_values.at (1 )) == 0x2 );
175175}
176+
177+ TEST_CASE (" Parse message with BO_ on single line should fail." ) {
178+ std::string dbc_contents = PRIMITIVE_DBC + R"( BO_
179+ 234 MSG1: 8 Vector__XXX
180+ SG_ State1 : 0|8@1+ (1,0) [0|200] "Km/h" DEVICE1,DEVICE2,DEVICE3
181+ SG_ State2 : 0|8@1+ (1,0) [0|204] "" DEVICE1,DEVICE2,DEVICE3
182+ VAL_ 234 State1 123 "Description 1" 0 "Description 2" 90903489 "Big value and special characters &$§())!")" ;
183+ const auto filename = create_temporary_dbc_with (dbc_contents.c_str ());
184+
185+ Libdbc::DbcParser p;
186+ p.parse_file (filename);
187+
188+ std::vector<uint8_t > data{0x1 , 0x2 };
189+ std::vector<double > result_values;
190+ REQUIRE (p.get_messages ().size () == 0 );
191+ REQUIRE (p.parse_message (234 , data, result_values) == Libdbc::Message::ParseSignalsStatus::ErrorUnknownID);
192+ }
193+
194+ TEST_CASE (" Parse signal with SG_ on single line should fail." ) {
195+ std::string dbc_contents = PRIMITIVE_DBC + R"( BO_ 234 MSG1: 8 Vector__XXX
196+ SG_
197+ State1 : 0|8@1+ (1,0) [0|200] "Km/h" DEVICE1,DEVICE2,DEVICE3
198+ SG_ State2 : 0|8@1+ (1,0) [0|204] "" DEVICE1,DEVICE2,DEVICE3
199+ VAL_ 234 State1 123 "Description 1" 0 "Description 2" 90903489 "Big value and special characters &$§())!")" ;
200+ const auto filename = create_temporary_dbc_with (dbc_contents.c_str ());
201+
202+ Libdbc::DbcParser p;
203+ p.parse_file (filename);
204+
205+ std::vector<uint8_t > data{0x1 , 0x2 };
206+ std::vector<double > result_values;
207+ REQUIRE (p.get_messages ().size () == 1 );
208+ REQUIRE (p.parse_message (234 , data, result_values) == Libdbc::Message::ParseSignalsStatus::Success);
209+ REQUIRE (result_values.size () == 1 );
210+ REQUIRE (Catch::Approx (result_values.at (0 )) == 0x1 );
211+ }
0 commit comments