torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SampleCodeUnitTest.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 SampleCode class.
18 
19 #include <boost/test/unit_test.hpp>
24 #include "torc/physical/Design.hpp"
25 #include <fstream>
26 
27 namespace torc {
28 namespace physical {
29 
30 BOOST_AUTO_TEST_SUITE(physical)
31 
32 /// \brief Unit test demonstrating some sample code.
33 BOOST_AUTO_TEST_CASE(SampleCodeUnitTest) {
34 
35  // create the appropriate file paths
37  / "torc" / "physical" / "DesignUnitTest.reference.xdl";
39  / "regression" / "DesignUnitTest.reference.xdl";
40 
41  // import the XDL design
42  std::fstream fileStream(referencePath.string().c_str());
43  BOOST_REQUIRE(fileStream.good());
44  XdlImporter importer;
45  importer(fileStream, referencePath.string());
46 
47  // look up the design (and do something with it ...)
48  DesignSharedPtr designPtr = importer.getDesignPtr();
49  BOOST_REQUIRE(designPtr.get() != 0);
50 
51  // export the XDL design
52  std::fstream xdlExport(generatedPath.string().c_str(), std::ios_base::out);
53  XdlExporter fileExporter(xdlExport);
54  fileExporter(designPtr);
55 
56 }
57 
58 BOOST_AUTO_TEST_SUITE_END()
59 
60 } // namespace physical
61 } // namespace torc
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 the XdlImporter class.
Header for the XdlExport class.
Header for the Design class.
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
Importer from XDL format into a physical design.
Header for the Factory class.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31