File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,6 @@ jobs:
218218 - name : Make build directory
219219 run : cmake -Bbuild -H$GITHUB_WORKSPACE
220220
221- - name : Run clang-tidy check
221+ - name : Run build
222222 run : cmake --build build
223223
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ DbcParser::DbcParser()
5959 : version_re(" ^(VERSION)\\ s\" (.*)\" " )
6060 , bit_timing_re(" ^(BS_:)" )
6161 , name_space_re(" ^(NS_)\\ s\\ :" )
62- , node_re(" ^(BU_:)\\ s((?:[\\ w]+?\\ s?)*)" )
62+ , node_re(" ^(BU_:)\\ s? ((?:[\\ w]+?\\ s?)*)? " )
6363 , message_re(" ^(BO_)\\ s(\\ d+)\\ s(\\ w+)\\ :\\ s(\\ d+)\\ s(\\ w+|Vector__XXX)" )
6464 , value_re(" ^(VAL_)\\ s(\\ d+)\\ s(\\ w+)((?:\\ s(\\ d+)\\ s\" ([^\" ]*)\" )+)\\ s;$" )
6565 ,
Original file line number Diff line number Diff line change @@ -239,3 +239,30 @@ VAL_ 123 State1 123 "Description 3" 0 "Description 4" ;)";
239239 REQUIRE (signal2.value_descriptions .at (1 ).value == 0 );
240240 REQUIRE (signal2.value_descriptions .at (1 ).description == " Description 4" );
241241}
242+
243+ TEST_CASE (" Should parse DBC with empty BU_" ) {
244+ std::string contents = R"( VERSION ""
245+
246+
247+ NS_ :
248+
249+ BS_:
250+
251+ BU_:
252+
253+
254+ BO_ 293 Msg1: 2 Vector__XXX
255+ SG_ Wert7 : 0|16@1- (1,0) [0|0] "" Vector__XXX
256+
257+ BO_ 292 Msg2: 8 Vector__XXX
258+ SG_ Wert8 : 56|8@1- (1,0) [0|0] "" Vector__XXX
259+ )" ;
260+ const auto filename = create_temporary_dbc_with (contents.c_str ());
261+
262+ auto parser = Libdbc::DbcParser ();
263+ parser.parse_file (filename.c_str ());
264+
265+ REQUIRE (parser.get_messages ().size () == 2 );
266+ REQUIRE (parser.get_messages ().at (0 ).name () == " Msg1" );
267+ REQUIRE (parser.get_messages ().at (1 ).name () == " Msg2" );
268+ }
You can’t perform that action at this time.
0 commit comments