- set_test_name("Check empty lines and comments");
-
- {
- ofstream f("/tmp/test.cf");
-
- ensure("Correct construction (part 3)", f);
-
- f << "\n"
- << "a=a-string# a string\n"
- << " \n"
- << "b=0\n"
- << "#abc\n"
- << "e=2.718281828\n";
- }
-
- {
- CONFIGFILE cf("/tmp/test.cf");
-
- ensure_equals("Correct construction (part 4)", cf.Error(), 0);
-
- std::string svalue;
- ensure_equals("Correct reading 'a' param as string", cf.ReadString("a", &svalue, "a-default"), 0);
- int ivalue;
- ensure_equals("Correct reading 'b' param as integer", cf.ReadInt("b", &ivalue, -1), 0);
- double dvalue = 0;
- ensure_equals("Correct reading 'e' param as double", cf.ReadDouble("e", &dvalue, 0), 0);
-
- ensure_equals("Correct 'a' value", svalue, "a-string");
- ensure_equals("Correct 'b' value", ivalue, 0);
- ensure("Correct 'e' value", dvalue != 0);
- }
-
- ensure_equals("Correct temporary file unlinking", unlink("/tmp/test.cf"), 0);
+ CONFIGFILE cf("/tmp/test.cf");
+
+ BOOST_CHECK_EQUAL(cf.Error(), 0);
+
+ std::string svalue;
+ BOOST_CHECK_EQUAL(cf.ReadString("a", &svalue, "a-default"), 0);
+ int ivalue;
+ BOOST_CHECK_EQUAL(cf.ReadInt("b", &ivalue, -1), 0);
+ double dvalue = 0;
+ BOOST_CHECK_EQUAL(cf.ReadDouble("e", &dvalue, 0), 0);
+
+ BOOST_CHECK_EQUAL(svalue, "a-string");
+ BOOST_CHECK_EQUAL(ivalue, 0);
+ BOOST_CHECK(dvalue != 0);