X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/975fb32b5cac366ad89be9c1d42cca9a789e1802..5dec941a5ba3c08870ab4b415dd6e5be368fa0f0:/tests/config/fileconf.cpp diff --git a/tests/config/fileconf.cpp b/tests/config/fileconf.cpp index 4a354479b9..7a9c2d73f6 100644 --- a/tests/config/fileconf.cpp +++ b/tests/config/fileconf.cpp @@ -82,6 +82,7 @@ private: CPPUNIT_TEST( AddToExistingRoot ); CPPUNIT_TEST( ReadNonExistent ); CPPUNIT_TEST( ReadEmpty ); + CPPUNIT_TEST( ReadFloat ); CPPUNIT_TEST_SUITE_END(); void Path(); @@ -105,6 +106,7 @@ private: void AddToExistingRoot(); void ReadNonExistent(); void ReadEmpty(); + void ReadFloat(); static wxString ChangePath(wxFileConfig& fc, const wxChar *path) @@ -129,7 +131,7 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( FileConfigTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FileConfigTestCase, "FileConfigTestCase" ); void FileConfigTestCase::Path() @@ -659,5 +661,24 @@ void FileConfigTestCase::ReadEmpty() wxFileConfig fc(sis); } +void FileConfigTestCase::ReadFloat() +{ + static const char *confTest = + "x=1.234\n" + "y=-9876.5432\n" + "z=2e+308\n" + ; + + wxStringInputStream sis(confTest); + wxFileConfig fc(sis); + + float f; + CPPUNIT_ASSERT( fc.Read("x", &f) ); + CPPUNIT_ASSERT_EQUAL( 1.234f, f ); + + CPPUNIT_ASSERT( fc.Read("y", &f) ); + CPPUNIT_ASSERT_EQUAL( -9876.5432f, f ); +} + #endif // wxUSE_FILECONFIG