X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f291c98e52434bd64aba83e7145f87a7d51710d8..4f2511d706e5274a34e1521e11c1b95fed735b42:/tests/strings/crt.cpp diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index ea161f91a2..70ad0d9fed 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -47,12 +47,14 @@ private: CPPUNIT_TEST( Strcmp ); CPPUNIT_TEST( Strspn ); CPPUNIT_TEST( Strcspn ); + CPPUNIT_TEST( Strpbrk ); CPPUNIT_TEST_SUITE_END(); void SetGetEnv(); void Strcmp(); void Strspn(); void Strcspn(); + void Strpbrk(); DECLARE_NO_COPY_CLASS(CrtTestCase) }; @@ -177,3 +179,33 @@ void CrtTestCase::Strcspn() CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrcspn(strWX, "xy") ); } +void CrtTestCase::Strpbrk() +{ + const wxString s(", "); + + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, ", ") ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, L", ") ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, ", ") ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX, L", ") ); + + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s) ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s) ); + + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s.c_str()) ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s.c_str()) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s.c_str()) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s.c_str()) ); + + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s.mb_str()) ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s.wc_str()) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s.mb_str()) ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX, s.wc_str()) ); + CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s.mb_str()) ); + CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX.c_str(), s.wc_str()) ); + + CPPUNIT_ASSERT_EQUAL( (const char *)NULL, wxStrpbrk(strWX, "xyz") ); + CPPUNIT_ASSERT_EQUAL( (const wchar_t *)NULL, wxStrpbrk(strWX.c_str(), L"xyz") ); +} +