30#include <boost/test/data/test_case.hpp> 
   60    { 845466002, 2147483640 },
 
   61    { -845466002, -2147483640 },
 
   63    { 845466003, 2147483640 },
 
   64    { -845466003, -2147483640 },
 
   65    { 1000000000, 2147483640 },
 
   66    { -1000000000, -2147483640 },
 
  111    { -118110, -300000 },
 
  112    { -157480, -400000 },
 
  113    { -196850, -500000 },
 
  114    { -236220, -600000 },
 
  115    { -275591, -700000 },
 
  116    { -314961, -800000 },
 
  117    { -354331, -900000 },
 
  118    { -393701, -1000000 },
 
 
  148    { 
"-0.1mil", -2540 },
 
  150    { 
"-0.01mil", -250 },
 
  152    { 
"-0.001mil", -30 },
 
  156    { 
"-0.00001mil", -0 },
 
  159    { 
"-10mil", -254000 },
 
  160    { 
"100mil", 2540000 },
 
  161    { 
"-100mil", -2540000 },
 
  162    { 
"1000mil", 25400000 },
 
  163    { 
"-1000mil", -25400000 },
 
  164    { 
"10000mil", 254000000 },
 
  165    { 
"-10000mil", -254000000 },
 
  167    { 
"84546.6002mil", 2147483640 },
 
  168    { 
"-84546.6002mil", -2147483640 },
 
  170    { 
"84546.6003mil", 2147483640 },
 
  171    { 
"-84546.6003mil", -2147483640 },
 
  172    { 
"100000mil", 2147483640 },
 
  173    { 
"-100000mil", -2147483640 },
 
  174    { 
"1000000mil", 2147483640 },
 
  175    { 
"-1000000mil", -2147483640 },
 
  176    { 
"10000000mil", 2147483640 },
 
  177    { 
"-10000000mil", -2147483640 },
 
 
  194    std::map<wxString, wxString> properties = { { 
"TEST", input_value } };
 
 
  206static const std::vector<std::tuple<std::string, std::map<wxString, wxString>>> 
read_properties = {
 
  215    { 
"|=", { { 
"", 
"" } } },
 
  216    { 
"|=\0", { { 
"", 
"" } } },
 
  217    { 
"|  =  ", { { 
"", 
"" } } },
 
  218    { 
"|  =  \0", { { 
"", 
"" } } },
 
  220    { 
"|A=\0", { { 
"A", 
"" } } },
 
  221    { 
"|A=B", { { 
"A", 
"B" } } },
 
  222    { 
"|A=B\0", { { 
"A", 
"B" } } },
 
  223    { 
"|A=B|", { { 
"A", 
"B" } } },
 
  224    { 
"|A=B|\0", { { 
"A", 
"B" } } },
 
  225    { 
"A=\0", { { 
"A", 
"" } } },
 
  226    { 
"A=B", { { 
"A", 
"B" } } },
 
  227    { 
"A=B\0", { { 
"A", 
"B" } } },
 
  228    { 
"A=B|", { { 
"A", 
"B" } } },
 
  229    { 
"A=B|\0", { { 
"A", 
"B" } } },
 
  231    { 
"|A=B|C=D|\0", { { 
"A", 
"B" }, { 
"C", 
"D" } } },
 
  232    { 
"A=B|C=D|\0", { { 
"A", 
"B" }, { 
"C", 
"D" } } },
 
  234    { 
"|A=B|A=C\0", { { 
"A", 
"B" } } },
 
  235    { 
"|A=B|A=C|A=D|A=E|A=F\0", { { 
"A", 
"B" } } },
 
  237    { 
"|a=b\0", { { 
"A", 
"b" } } },
 
  238    { 
"|abc123=b\0", { { 
"ABC123", 
"b" } } },
 
  240    { 
"|A=  B\0", { { 
"A", 
"  B" } } },
 
  241    { 
"|A=B  \0", { { 
"A", 
"B" } } },
 
  242    { 
"|  A=B\0", { { 
"A", 
"B" } } },
 
  243    { 
"|A  =B\0", { { 
"A", 
"B" } } },
 
  244    { 
"|A=\nB\n\0", { { 
"A", 
"\nB" } } },
 
  245    { 
"A=  B\0", { { 
"A", 
"  B" } } },
 
  246    { 
"A=B  \0", { { 
"A", 
"B" } } },
 
  247    { 
"  A=B\0", { { 
"A", 
"B" } } },
 
  248    { 
"A  =B\0", { { 
"A", 
"B" } } },
 
  249    { 
"A=\nB\n\0", { { 
"A", 
"\nB" } } },
 
  252    { 
"|A==\0", { { 
"A", 
"=" } } },
 
  253    { 
"|A=a\na\0", { { 
"A", 
"a\na" } } },
 
  254    { 
"|A=a\ta\0", { { 
"A", 
"a\ta" } } },
 
  256    { 
"|%UTF8%A=abc\0", { { 
"%UTF8%A", 
"abc" } } },
 
  257    { 
"|%UTF8%A=\xc2\xa6\0", { { 
"%UTF8%A", { 
"\xc2\xa6", wxConvUTF8 } } } }, 
 
  259    { 
"|A|B=C\0", { { 
"B", 
"C" } } },
 
  260    { 
"|A=B|C\0", { { 
"A", 
"B" } } },
 
 
  271    size_t                  size = 4 + input_value.size();
 
  272    std::unique_ptr<char[]> content = std::make_unique<char[]>( size );
 
  274    *content.get() = input_value.size();
 
  275    std::memcpy( content.get() + 4, input_value.c_str(), input_value.size() );
 
  284    BOOST_CHECK_EQUAL_COLLECTIONS( 
result.begin(), 
result.end(),
 
  285                                   expected_result.begin(), expected_result.end() );
 
 
size_t GetRemainingBytes() const
 
std::map< wxString, wxString > ReadProperties(std::function< std::map< wxString, wxString >(const std::string &)> handleBinaryData=[](const std::string &) { return std::map< wxString, wxString >();})
 
static int32_t ReadKicadUnit(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
 
static int32_t ConvertToKicadUnit(const double aValue)
 
ALTIUM_BINARY_PARSER_FIXTURE()
 
BOOST_DATA_TEST_CASE(ConvertToKicadUnit, boost::unit_test::data::make(altium_to_kicad_unit), input_value, expected_result)
Test conversation from Altium internal units into KiCad internal units.
 
static const std::vector< std::tuple< int, int > > altium_to_kicad_unit
Declares the struct as the Boost test fixture.
 
static const std::vector< std::tuple< wxString, int > > read_kicad_unit_property
A list of valid test strings and the expected results.
 
static const std::vector< std::tuple< std::string, std::map< wxString, wxString > > > read_properties
A list of valid test strings and the expected result map.
 
BOOST_AUTO_TEST_SUITE_END()
 
wxString result
Test unit parsing edge cases and error handling.
 
BOOST_CHECK_EQUAL(result, "25.4")