- CPPUNIT_ASSERT_EQUAL( 'A', wxToupper_l('A', loc) );
- CPPUNIT_ASSERT_EQUAL( 'A', wxToupper_l('a', loc) );
- CPPUNIT_ASSERT_EQUAL( 'Z', wxToupper_l('Z', loc) );
- CPPUNIT_ASSERT_EQUAL( 'Z', wxToupper_l('z', loc) );
- CPPUNIT_ASSERT_EQUAL( '0', wxToupper_l('0', loc) );
- CPPUNIT_ASSERT_EQUAL( '9', wxToupper_l('9', loc) );
+ CPPUNIT_ASSERT_EQUAL( 'A', (char)wxToupper_l('A', loc) );
+ CPPUNIT_ASSERT_EQUAL( 'A', (char)wxToupper_l('a', loc) );
+ CPPUNIT_ASSERT_EQUAL( 'Z', (char)wxToupper_l('Z', loc) );
+ CPPUNIT_ASSERT_EQUAL( 'Z', (char)wxToupper_l('z', loc) );
+ CPPUNIT_ASSERT_EQUAL( '0', (char)wxToupper_l('0', loc) );
+ CPPUNIT_ASSERT_EQUAL( '9', (char)wxToupper_l('9', loc) );
+}
+
+// test the stdlib functions with the given locale
+void XLocaleTestCase::TestStdlibFunctionsWith(const wxXLocale& loc)
+{
+ // NOTE: here go the checks which must pass under _any_ locale "loc";
+ // checks for specific locales are in TestStdlibFunctions()
+
+#if wxUSE_UNICODE
+ wchar_t* endptr;
+#else
+ char* endptr;
+#endif
+
+ // strtod (don't use decimal separator as it's locale-specific)
+ CPPUNIT_ASSERT_EQUAL( 0.0, wxStrtod_l(wxT("0"), NULL, loc) );
+ CPPUNIT_ASSERT_EQUAL( 1234.0, wxStrtod_l(wxT("1234"), NULL, loc) );
+
+ // strtol
+ endptr = NULL;
+ CPPUNIT_ASSERT_EQUAL( 100, wxStrtol_l(wxT("100"), NULL, 0, loc) );
+ CPPUNIT_ASSERT_EQUAL( 0xFF, wxStrtol_l(wxT("0xFF"), NULL, 0, loc) );
+ CPPUNIT_ASSERT_EQUAL( 2001, wxStrtol_l(wxT("2001 60c0c0 -1101110100110100100000 0x6fffff"), &endptr, 10, loc) );
+ CPPUNIT_ASSERT_EQUAL( 0x60c0c0, wxStrtol_l(endptr, &endptr, 16, loc) );
+ CPPUNIT_ASSERT_EQUAL( -0x374D20, wxStrtol_l(endptr, &endptr, 2, loc) );
+ CPPUNIT_ASSERT_EQUAL( 0x6fffff, wxStrtol_l(endptr, NULL, 0, loc) );
+
+ // strtoul
+ // NOTE: 3147483647 and 0xEE6B2800 are greater than LONG_MAX (on 32bit machines) but
+ // smaller than ULONG_MAX
+ CPPUNIT_ASSERT_EQUAL( 3147483647ul, wxStrtoul_l(wxT("3147483647"), NULL, 0, loc) );
+ CPPUNIT_ASSERT_EQUAL( 0xEE6B2800ul, wxStrtoul_l(wxT("0xEE6B2800"), NULL, 0, loc) );
+
+ // TODO: test for "failure" behaviour of the functions above