fixed a lot of issues, now successfully runs the test with --enable-pedantic; refs #8

This commit is contained in:
Marc Wäckerlin
2014-03-28 11:50:39 +00:00
parent e846c326f1
commit 190b469d56
33 changed files with 398 additions and 409 deletions

View File

@@ -35,31 +35,42 @@ public:
std::string srcdir(mrw::ifelse(getenv("srcdir"), "."));
mrw::File::copy(srcdir+"/configfile.ini", "configfile2.ini");
mrw::ConfigFileWriter config("configfile2.ini");
CPPUNIT_ASSERT(config("", "xxx", ".")=="yyy");
CPPUNIT_ASSERT(config("Section", "abc", ".")=="");
CPPUNIT_ASSERT(config("Section", "def", ".")=="hallo welt");
CPPUNIT_ASSERT(config("Section", "ghi", ".")=="");
CPPUNIT_ASSERT(config("Section", "jkl", ".")=="mn\n op qr\n st");
CPPUNIT_ASSERT(config("Other Section", "1234", ".")=="5678=90");
CPPUNIT_ASSERT(config("Other Section", "here we are", ".")
=="some contents");
CPPUNIT_ASSERT(config("Other Section", "here", ".")=="");
CPPUNIT_ASSERT_EQUAL(std::string("yyy"), config("", "xxx", ".")());
CPPUNIT_ASSERT_EQUAL(std::string(), config("Section", "abc", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("hallo welt"),
config("Section", "def", ".")());
CPPUNIT_ASSERT_EQUAL(std::string(), config("Section", "ghi", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("mn\n op qr\n st"),
config("Section", "jkl", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("5678=90"),
config("Other Section", "1234", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("some contents"),
config("Other Section", "here we are", ".")());
CPPUNIT_ASSERT_EQUAL(std::string(), config("Other Section", "here", ".")());
config("", "xxx", ".")="0";
config("Section", "abc", ".")="1";
CPPUNIT_ASSERT(config("New Section", "a first one", "sgadd")=="sgadd");
CPPUNIT_ASSERT_EQUAL(std::string("sgadd"),
config("New Section", "a first one", "sgadd")());
config("Section", "def", ".")="Und=Tschuess";
config("Section", "ghi", ".")="3";
config("Section", "jkl", ".")="4";
config("Other Section", "1234", ".")="5";
config("Other Section", "here we are", ".")="6";
config("Other Section", "here", ".")="7";
CPPUNIT_ASSERT(config("Other Section", "no no", ".")==".");
CPPUNIT_ASSERT(config("Other Section", "no no no", ".")==".");
CPPUNIT_ASSERT(config("Other Section", "yes", ".")==".");
CPPUNIT_ASSERT(config("Section", "guguseli", "dadaa")=="dadaa");
CPPUNIT_ASSERT(config("Section", "guguseli zwei", "dadaa")=="dadaa");
CPPUNIT_ASSERT(config("Section", "guguseli drei", "dadaa")=="dadaa");
CPPUNIT_ASSERT(config("New Section", "one more", ".")==".");
CPPUNIT_ASSERT_EQUAL(std::string("."),
config("Other Section", "no no", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("."),
config("Other Section", "no no no", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("."),
config("Other Section", "yes", ".")());
CPPUNIT_ASSERT_EQUAL(std::string("dadaa"),
config("Section", "guguseli", "dadaa")());
CPPUNIT_ASSERT_EQUAL(std::string("dadaa"),
config("Section", "guguseli zwei", "dadaa")());
CPPUNIT_ASSERT_EQUAL(std::string("dadaa"),
config("Section", "guguseli drei", "dadaa")());
CPPUNIT_ASSERT_EQUAL(std::string("."),
config("New Section", "one more", ".")());
}
CPPUNIT_TEST_SUITE(ConfigFileTest);
CPPUNIT_TEST(CheckFile);