Move WX_ASSERT_STRARRAY_EQUAL() to the only test using it

It doesn't seem useful to have this macro in the header included by all
tests when it's only used in a single one of them.
This commit is contained in:
Vadim Zeitlin
2017-10-30 14:44:20 +01:00
parent 9f609a8148
commit 7b10210763
2 changed files with 17 additions and 17 deletions

View File

@@ -168,23 +168,6 @@ WX_CPPUNIT_ALLOW_EQUALS_TO_INT(wxLongLong_t)
WX_CPPUNIT_ALLOW_EQUALS_TO_INT(unsigned wxLongLong_t)
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
// Use this macro to compare a wxArrayString with the pipe-separated elements
// of the given string
//
// NB: it's a macro and not a function to have the correct line numbers in the
// test failure messages
#define WX_ASSERT_STRARRAY_EQUAL(s, a) \
{ \
wxArrayString expected(wxSplit(s, '|', '\0')); \
\
CPPUNIT_ASSERT_EQUAL( expected.size(), a.size() ); \
\
for ( size_t n = 0; n < a.size(); n++ ) \
{ \
CPPUNIT_ASSERT_EQUAL( expected[n], a[n] ); \
} \
}
// Use this macro to assert with the given formatted message (it should contain
// the format string and arguments in a separate pair of parentheses)
#define WX_ASSERT_MESSAGE(msg, cond) \

View File

@@ -58,6 +58,23 @@ CPPUNIT_TEST_SUITE_REGISTRATION( CmdLineTestCase );
// also include in its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CmdLineTestCase, "CmdLineTestCase" );
// Use this macro to compare a wxArrayString with the pipe-separated elements
// of the given string
//
// NB: it's a macro and not a function to have the correct line numbers in the
// test failure messages
#define WX_ASSERT_STRARRAY_EQUAL(s, a) \
{ \
wxArrayString expected(wxSplit(s, '|', '\0')); \
\
CPPUNIT_ASSERT_EQUAL( expected.size(), a.size() ); \
\
for ( size_t n = 0; n < a.size(); n++ ) \
{ \
CPPUNIT_ASSERT_EQUAL( expected[n], a[n] ); \
} \
}
// ============================================================================
// implementation
// ============================================================================