00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <boost/test/unit_test.hpp>
00020 #include <boost/filesystem/convenience.hpp>
00021 #include "torc/packer/XdlUnpack.hpp"
00022 #include "torc/common/DirectoryTree.hpp"
00023 #include "torc/physical/XdlImporter.hpp"
00024 #include "torc/physical/XdlExporter.hpp"
00025 #include "torc/physical/OutputStreamHelpers.hpp"
00026 #include "torc/common/TestHelpers.hpp"
00027 #include <fstream>
00028
00029 namespace torc {
00030 namespace physical {
00031
00032 BOOST_AUTO_TEST_SUITE(packer)
00033
00034
00035 BOOST_AUTO_TEST_CASE(XdlUnpackUnitTest) {
00036
00037
00038 boost::filesystem::path regressionPath
00039 = torc::common::DirectoryTree::getExecutablePath() / "regression";
00040 boost::filesystem::path generatedPath = regressionPath / "XdlUnpackUnitTest.xdl";
00041 boost::filesystem::path referencePath = regressionPath / "DesignUnitTest.reference.xdl";
00042
00043
00044 std::fstream fileStream(referencePath.string().c_str());
00045 BOOST_REQUIRE(fileStream.good());
00046 torc::physical::XdlImporter importer;
00047 importer(fileStream, referencePath.string());
00048
00049
00050 torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
00051 torc::physical::XdlUnpack unpacker;
00052 torc::physical::DesignSharedPtr unpackedDesignPtr = unpacker(designPtr);
00053
00054
00055 std::fstream xdlExport(generatedPath.string().c_str(), std::ios_base::out);
00056 BOOST_REQUIRE(xdlExport.good());
00057 XdlExporter fileExporter(xdlExport);
00058 fileExporter(unpackedDesignPtr);
00059
00060 }
00061
00062 BOOST_AUTO_TEST_SUITE_END()
00063
00064 }
00065 }
00066