45 const std::vector<INCREMENT_TEST_CASE> cases{
47 {
"", 1, 0,
"nullopt" },
48 {
"", 1, 1,
"nullopt" },
49 {
"", -1, 1,
"nullopt" },
57 {
"0", -1, 0,
"nullopt" },
59 {
"1", 1, 1,
"nullopt" },
74 {
"ABB", 1, 0,
"nullopt" },
76 {
"A-1", 1, 0,
"A-2" },
77 {
"A-1", 1, 1,
"B-1" },
79 {
"A12", 1, 0,
"A13" },
80 {
"A12", -1, 0,
"A11" },
81 {
"A12", 1, 1,
"B12" },
82 {
"A12", -1, 1,
"nullopt" },
88 for(
const auto& c : cases )
90 BOOST_TEST_INFO(
"Input: " << c.input <<
" Delta: " << c.delta <<
" Part: " << c.part );
91 wxString
result = incrementer.
Increment( c.input, c.delta, c.part ).value_or(
"nullopt" );
107 const wxString alphabet =
"ABCDEFGHJKLMNPRTUVWY";
109 const std::vector<ALPHABETIC_TEST_CASE> cases{ {
110 {
"A", alphabet, 0 },
111 {
"B", alphabet, 1 },
112 {
"Y", alphabet, 19 },
113 {
"AA", alphabet, 20 },
114 {
"AY", alphabet, 39 },
117 for(
const auto& c : cases )
Heuristically increment a string's n'th part from the right.
void SetSkipIOSQXZ(bool aSkip)
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z.
std::optional< wxString > Increment(const wxString &aStr, int aDelta, size_t aRightIndex) const
Increment the n-th part from the right of the given string.
KICOMMON_API int IndexFromAlphabetic(const wxString &aStr, const wxString &aAlphabet)
Attempt to convert a string to an integer, assuming it is an alphabetic string like "A",...
wxString KICOMMON_API AlphabeticFromIndex(size_t aN, const wxString &aAlphabet, bool aZeroBasedNonUnitCols)
Get an alphabetic string like A, B, ... Z, AA, AB, ... ZZ, AAA, ...
const wxString & alphabet
Declares a struct as the Boost test fixture.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(BasicCase)
Check formatting the point.
BOOST_TEST_INFO("Two-port Series .op current = "<< iDevice)
wxString result
Test unit parsing edge cases and error handling.
BOOST_CHECK_EQUAL(result, "25.4")