45 using CASE = std::pair<std::string, int>;
47 const std::vector<CASE> cases = {
48 {
"", 0 }, {
"foo", 0 },
52 {
"Foo42", 42 }, {
"12Foo42", 42 },
56 for(
const auto& c : cases )
68 using CASE = std::pair<std::pair<std::string, std::string>, std::pair<int, int>>;
70 const std::vector<CASE> cases = {
71 { {
"a",
"b" }, { -1, -1 } },
72 { {
"b",
"a" }, { 1, 1 } },
73 { {
"a",
"a" }, { 0, 0 } },
74 { {
"a",
"A" }, { 1, 0 } },
75 { {
"A",
"a" }, { -1, 0 } },
76 { {
"a",
"" }, { 1, 1 } },
77 { {
"",
"a" }, { -1, -1 } },
78 { {
"1",
"" }, { 1, 1 } },
79 { {
"",
"1" }, { -1, -1 } },
80 { {
"10",
"2" }, { 1, 1 } },
81 { {
"2",
"10" }, { -1, -1 } },
82 { {
"2",
"2" }, { 0, 0 } },
83 { {
"10",
"10" }, { 0, 0 } },
84 { {
"01",
"1" }, { 0, 0 } },
85 { {
"01a",
"1a" }, { 0, 0 } },
86 { {
"01a",
"1b" }, { -1, -1 } },
87 { {
"01b",
"1a" }, { 1, 1 } },
88 { {
"10 ten",
"2 two" }, { 1, 1 } },
89 { {
"SYM1",
"sym2" }, { -1, -1 } },
90 { {
"sym2",
"SYM1" }, { 1, 1 } },
91 { {
"a10b20c30",
"a10b20c31" }, { -1, -1 } },
92 { {
"a10b20c31",
"a10b20c30" }, { 1, 1 } },
93 { {
"10UF",
"10UF" }, { 0, 0 } },
94 { {
"10uF",
"10uF" }, { 0, 0 } },
95 { {
"u10",
"u10" }, { 0, 0 } },
96 { {
"U10",
"U10" }, { 0, 0 } },
97 { {
"u10",
"U10" }, { 1, 0 } },
98 { {
"U10",
"u10" }, { -1, 0 } },
99 { {
"U10.1",
"U10.10" }, { -1, -1 } },
100 { {
"U10-1",
"U10-10" }, { -1, -1 } },
101 { {
"U10,1",
"U10,10" }, { -1, -1 } },
102 { {
"U10.A",
"U10.a" }, { -1, 0 } },
103 { {
"U10-A",
"U10-a" }, { -1, 0 } },
104 { {
"U10,A",
"U10,a" }, { -1, 0 } },
107 for(
const auto& c : cases )
109 BOOST_CHECK_MESSAGE(
StrNumCmp( c.first.first, c.first.second ) == c.second.first,
110 c.first.first +
" AND " + c.first.second +
" failed for case sensitive" );
113 StrNumCmp( c.first.first, c.first.second,
true ) == c.second.second,
114 c.first.first +
" AND " + c.first.second +
" failed for case insensitive" );
124 using CASE = std::pair<double, std::string>;
127 const std::vector<CASE> cases = {
131 { 0.00001523,
"0.00001523" },
132 { 0.00000000000000001523,
"0" },
133 { 623523,
"623523" },
136 for(
const auto& c : cases )
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TrailingInt)
Declare the test suite.