59 boost::bimap<ProtoEnum, KiCadEnum> protoToKiCadSeen;
60 std::set<ProtoEnum> seenProtos;
62 for( ProtoEnum value : magic_enum::enum_values<ProtoEnum>() )
65 << magic_enum::enum_name( value ) )
67 std::string
name( magic_enum::enum_name( value ) );
68 auto splitPos =
name.find_first_of(
'_' );
71 BOOST_REQUIRE_MESSAGE( splitPos != std::string::npos,
72 "Proto enum name doesn't have a prefix" );
74 std::string suffix =
name.substr( splitPos );
77 if(
static_cast<int>( value ) == 0 )
79 BOOST_REQUIRE_MESSAGE( suffix.compare(
"_UNKNOWN" ) == 0,
80 "Proto enum with value 0 must be named <PREFIX>_UNKNOWN" );
90 protoToKiCadSeen.left.insert( { value,
result } );
94 for( KiCadEnum value : magic_enum::enum_values<KiCadEnum>() )
97 << magic_enum::enum_name( value ) )
101 if( aPartiallyMapped )
110 BOOST_REQUIRE_MESSAGE( !protoToKiCadSeen.right.count( value ),
111 "Proto enum is mapped to this KiCad enum, but not vice versa" );
126 seenProtos.insert(
result );
wxString result
Test unit parsing edge cases and error handling.