torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PathFinderUnitTest.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 PathFinder class.
18 
19 #include <boost/test/unit_test.hpp>
23 
24 #include "PathFinder.hpp"
25 #include "NetRouter.hpp"
26 //#include "NetRouterHeuristic.hpp"
27 #include "PathFinderHeuristic.hpp"
28 #include "RouteUtilities.hpp"
30 
31 namespace torc {
32 namespace router {
33 
34 BOOST_AUTO_TEST_SUITE(router)
35 
36 /// \brief Unit test for the NetRouter.
38 
39  int& argc = boost::unit_test::framework::master_test_suite().argc;;
40  BOOST_REQUIRE(argc >= 1);
41 /* char**&argv = boost::unit_test::framework::master_test_suite().argv;;
42  torc::common::DirectoryTree directoryTree(argv[0]);
43  boost::filesystem::path testPath(directoryTree.getExecutablePath() / "torc" / "router");
44  boost::filesystem::path referencePath(testPath / "pathfindertest1.xdl");
45 std::cout << referencePath.string() << std::endl;
46 
47  std::fstream fileStream(referencePath.string().c_str());
48  BOOST_REQUIRE(fileStream.good());
49 
50  architecture::XdlImporter importer;
51 std::cout << "HERE" << std::endl;
52  importer(fileStream, referencePath.string());
53 std::cout << "AND HERE" << std::endl;
54 
55  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
56  BOOST_REQUIRE(designPtr.get() != 0);
57  BOOST_CHECK_EQUAL(designPtr->getNetCount(), 2376u);
58  architecture::DDB* ddbPtr = importer.releaseDDBPtr();
59 
60 
61 
62 // architecture::DDB ddb("xc5vlx110t");
63 // NetRouterHeuristicBase* h = new NetRouterHeuristic(*ddbPtr);
64  NetRouterHeuristicBase* h = new PathFinderNetRouterHeuristic(*ddbPtr);
65  NetRouterBase* r = new NetRouter(*ddbPtr, h);
66  NetVectorRouterHeuristicBase* vh = new PathFinderHeuristic(*ddbPtr);
67  NetVectorRouterBase* vr = new PathFinder(*ddbPtr, vh, r);
68 
69  RouteUtilities ru;
70  RouteNetVector nets;
71  std::cout << "RouteNets: " << nets.size() << std::endl;
72 
73  ru.design2routenets(designPtr->netsBegin(), designPtr->netsEnd(), nets);
74 
75  std::cout << "RouteNets: " << nets.size() << std::endl;
76  std::cout << *ddbPtr;
77  std::cout << "Clearing usage from import" << std::endl;
78  ddbPtr->clearUsage();
79 
80  vr->route(nets);
81 
82  std::cout << "Finished" << std::endl;*/
83 
84 }
85 
86 BOOST_AUTO_TEST_SUITE_END()
87 
88 } // namespace router
89 } // namespace torc
Header for the DirectoryTree class.
Header for the Heuristic class.
Header for the Utilities class.
Header for the DDB class.
Header for the PathfinderHeuristic class.
Header for the NetRouter class.
BOOST_AUTO_TEST_CASE(NetRouterHeuristicT)
Unit test for the Heuristic.
Header for the XdlImporter class.