+void FileConfigTestCase::AddToExistingRoot()
+{
+ static const wxChar *confInitial =
+ wxT("[Group]\n")
+ wxT("value1=foo\n");
+
+ wxStringInputStream sis(confInitial);
+ wxFileConfig fc(sis);
+
+ fc.Write(wxT("/value1"), wxT("bar"));
+ wxVERIFY_FILECONFIG(
+ wxT("value1=bar\n")
+ wxT("[Group]\n")
+ wxT("value1=foo\n"),
+ fc
+ );
+}
+
+void FileConfigTestCase::ReadNonExistent()
+{
+ static const char *confTest =
+ "community=censored\n"
+ "[City1]\n"
+ "URL=www.fake1.na\n"
+ "[City1/A1]\n"
+ "[City1/A1/1]\n"
+ "IP=192.168.1.66\n"
+ "URL=www.fake2.na\n"
+ ;
+
+ wxStringInputStream sis(confTest);
+ wxFileConfig fc(sis);
+
+ wxString url;
+ CPPUNIT_ASSERT( !fc.Read("URL", &url) );
+}
+
+void FileConfigTestCase::ReadEmpty()
+{
+ static const char *confTest = "";
+
+ wxStringInputStream sis(confTest);
+ 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 );
+}
+