58 boost::bimap<ProtoEnum, KiCadEnum> protoToKiCadSeen;
59 std::set<ProtoEnum> seenProtos;
61 for( ProtoEnum value : magic_enum::enum_values<ProtoEnum>() )
64 << magic_enum::enum_name( value ) )
66 std::string
name( magic_enum::enum_name( value ) );
67 auto splitPos =
name.find_first_of(
'_' );
70 BOOST_REQUIRE_MESSAGE( splitPos != std::string::npos,
71 "Proto enum name doesn't have a prefix" );
73 std::string suffix =
name.substr( splitPos );
76 if(
static_cast<int>( value ) == 0 )
78 BOOST_REQUIRE_MESSAGE( suffix.compare(
"_UNKNOWN" ) == 0,
79 "Proto enum with value 0 must be named <PREFIX>_UNKNOWN" );
89 protoToKiCadSeen.left.insert( { value,
result } );
93 for( KiCadEnum value : magic_enum::enum_values<KiCadEnum>() )
96 << magic_enum::enum_name( value ) )
100 if( aPartiallyMapped )
109 BOOST_REQUIRE_MESSAGE( !protoToKiCadSeen.right.count( value ),
110 "Proto enum is mapped to this KiCad enum, but not vice versa" );
125 seenProtos.insert(
result );
wxString result
Test unit parsing edge cases and error handling.