49 const std::vector<INCREMENT_TEST_CASE> cases{
51 {
"", 1, 0,
"nullopt" },
52 {
"", 1, 1,
"nullopt" },
53 {
"", -1, 1,
"nullopt" },
61 {
"0", -1, 0,
"nullopt" },
63 {
"1", 1, 1,
"nullopt" },
78 {
"ABB", 1, 0,
"nullopt" },
80 {
"A-1", 1, 0,
"A-2" },
81 {
"A-1", 1, 1,
"B-1" },
87 for(
const auto& c : cases )
89 BOOST_TEST_INFO(
"Input: " << c.input <<
" Delta: " << c.delta <<
" Part: " << c.part );
90 wxString result = incrementer.
Increment( c.input, c.delta, c.part ).value_or(
"nullopt" );
91 BOOST_CHECK_EQUAL( result, c.expected );
106 const wxString alphabet =
"ABCDEFGHJKLMNPRTUVWY";
108 const std::vector<ALPHABETIC_TEST_CASE> cases{ {
109 {
"A", alphabet, 0 },
110 {
"B", alphabet, 1 },
111 {
"Y", alphabet, 19 },
112 {
"AA", alphabet, 20 },
113 {
"AY", alphabet, 39 },
116 for(
const auto& c : cases )
118 BOOST_TEST_INFO(
"Input: " << c.input <<
" <-> " << c.expected );
121 BOOST_CHECK_EQUAL( fromString, c.expected );
124 BOOST_CHECK_EQUAL( fromIndex, c.input );
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.