53 const std::vector<VALID_OFFSET_CASE> cases = {
111 for(
const auto& c : cases )
116 bool offset_ok = axis.
SetOffset( c.m_offset_str );
118 BOOST_CHECK_EQUAL( offset_ok, c.m_exp_valid );
122 BOOST_CHECK_EQUAL( axis.
GetOffset(), c.m_exp_offset );
156 {
"1",
"2",
"3",
"4",
"5",
"6" },
178 {
"Y",
"Z",
"AA",
"AB" },
188 {
"11",
"13",
"15",
"17",
"19",
"21" },
200 BOOST_TEST_CONTEXT( c.m_case_name )
204 axis.
SetStep( c.m_prms.m_step );
206 bool start_ok = axis.
SetOffset( c.m_prms.m_start_at );
209 BOOST_CHECK( start_ok );
211 std::vector<std::string> names;
213 for(
int i = 0; i < c.m_num; i++ )
218 BOOST_CHECK_EQUAL_COLLECTIONS(
219 names.begin(), names.end(), c.m_exp_names.begin(), c.m_exp_names.end() );
Class that contains information about a single array axis and the numbering of items along that axis.
bool SetOffset(const wxString &aOffsetName)
Set the axis start (as a string, which should decode to a valid index in the alphabet)
wxString GetItemNumber(int n) const
Get the position number (name) for the n'th axis point.
void SetAxisType(NUMBERING_TYPE aType)
Set the axis numbering type.
@ NUMBERING_NUMERIC
Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
void SetStep(int aStep)
Set the skip between consecutive numbers (useful when doing a partial array, e.g.
int GetOffset() const
Get the numbering offset for the axis.
std::vector< std::string > m_exp_names
ARRAY_AXIS_NAMING_PARAMS m_prms
Data for testing a single array axis.
ARRAY_AXIS::NUMBERING_TYPE m_axis_type
ARRAY_AXIS::NUMBERING_TYPE m_axis_type
static const std::vector< ARRAY_AXIS_NAMING_CASE > axis_name_cases
BOOST_AUTO_TEST_CASE(ValidOffsets)
Check we can get valid (or invalid) offsets as expected.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()