Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/tests/test_CStr.h
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
void test_parse() | void test_parse() | ||||
{ | { | ||||
// Parsing should be independent of locale ("," vs "."), | // Parsing should be independent of locale ("," vs "."), | ||||
// because GTK+ can change the locale when we're running Atlas. | // because GTK+ can change the locale when we're running Atlas. | ||||
// (If the host system doesn't have the locale we're using for this test | // (If the host system doesn't have the locale we're using for this test | ||||
// then it'll just stick with the default, which is fine) | // then it'll just stick with the default, which is fine) | ||||
char* old = setlocale(LC_NUMERIC, NULL); | char* old = setlocale(LC_NUMERIC, "fr_FR.UTF-8"); | ||||
setlocale(LC_NUMERIC, "fr_FR.UTF-8"); | |||||
CStr8 str1("1.234"); | CStr8 str1("1.234"); | ||||
TS_ASSERT_DELTA(str1.ToFloat(), 1.234f, 0.0001f); | TS_ASSERT_DELTA(str1.ToFloat(), 1.234f, 0.0001f); | ||||
TS_ASSERT_DELTA(str1.ToDouble(), 1.234, 0.0001); | TS_ASSERT_DELTA(str1.ToDouble(), 1.234, 0.0001); | ||||
TS_ASSERT_EQUALS(str1.ToInt(), 1); | TS_ASSERT_EQUALS(str1.ToInt(), 1); | ||||
TS_ASSERT_EQUALS(str1.ToUInt(), 1u); | TS_ASSERT_EQUALS(str1.ToUInt(), 1u); | ||||
TS_ASSERT_EQUALS(str1.ToLong(), 1); | TS_ASSERT_EQUALS(str1.ToLong(), 1); | ||||
TS_ASSERT_EQUALS(str1.ToULong(), 1u); | TS_ASSERT_EQUALS(str1.ToULong(), 1u); | ||||
Show All 20 Lines |
Wildfire Games · Phabricator