00001 // See ../../license.txt for license information. 00002 // 00003 // test_base.cpp 00004 // 00005 // 4-Jul-2003 phamilton Created 00006 // 00007 00008 #include "test_base.hpp" 00009 #include <fstream> 00010 #include <boost/test/test_tools.hpp> 00011 using boost::test_toolbox::output_test_stream; 00012 #include "context.hpp" 00013 #include "../../common/deletable_object.hpp" 00014 #include "../xml/parseobj.hpp" 00015 00016 using namespace ph::persist; 00017 using namespace persist_test; 00018 00019 void test_base::dotest() 00020 { 00021 std::ifstream f(_infile.c_str()); 00022 BOOST_REQUIRE(f.is_open()); 00023 00024 context c; 00025 output_test_stream output; 00026 xml::parseobj parser(0, &f, _infile.c_str(), 00027 &c, false, &output, "", false, PARSEOBJ_NO_DEBUG); 00028 std::map<std::string, std::string> params; 00029 params["X"] = ".."; 00030 parser.add_params(params); 00031 00032 BOOST_REQUIRE(xml::parse::parse_xml(&f, _infile.c_str(), &parser, 0)); 00033 BOOST_CHECK(output.is_empty()); 00034 f.close(); 00035 BOOST_REQUIRE(parser.obj()); 00036 write_output(parser.obj(), _matchfile); 00037 if (parser.obj()->deletable()) 00038 parser.obj()->deletable()->delete_object(); 00039 else 00040 delete parser.obj(); 00041 }