torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XdlUnpackUnitTest.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Unit test for the XdlUnpack class.
18 
19 #include <boost/test/unit_test.hpp>
20 #include <boost/filesystem/convenience.hpp>
27 #include <fstream>
28 
29 namespace torc {
30 namespace physical {
31 
32 BOOST_AUTO_TEST_SUITE(packer)
33 
34 /// \brief Unit test for the XdlUnpack class.
35 BOOST_AUTO_TEST_CASE(XdlUnpackUnitTest) {
36  BOOST_MESSAGE("DEPRECATED: XdlUnpack is deprecated in favor of Unpacker.");
37  return;
38 
39  // create the appropriate file paths
40  boost::filesystem::path regressionPath
42  boost::filesystem::path generatedPath = regressionPath / "XdlUnpackUnitTest.xdl";
44  / "torc" / "physical" / "DesignUnitTest.reference.xdl";
45 
46  // import the XDL design
47  std::fstream fileStream(referencePath.string().c_str());
48  BOOST_REQUIRE(fileStream.good());
50  importer(fileStream, referencePath.string());
51 
52  // unpack the design
53  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
55  torc::physical::DesignSharedPtr unpackedDesignPtr = unpacker(designPtr);
56 
57  // export the created design
58  std::fstream xdlExport(generatedPath.string().c_str(), std::ios_base::out);
59  BOOST_REQUIRE(xdlExport.good());
60  XdlExporter fileExporter(xdlExport);
61  fileExporter(unpackedDesignPtr);
62 
63 }
64 
65 BOOST_AUTO_TEST_SUITE_END()
66 
67 } // namespace physical
68 } // namespace torc
69 
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
Header for the DirectoryTree class.
BOOST_AUTO_TEST_CASE(XdlUnpackUnitTest)
Unit test for the XdlUnpack class.
Header for Boost.Test helper functions.
Header for the XdlImporter class.
Header for the XdlExport class.
Header for torc::physical output stream helpers.
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
Importer from XDL format into a physical design.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31