torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RoutethroughUnitTest.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 Routethrough class.
18 
19 #include <boost/test/unit_test.hpp>
21 #include "torc/physical/Pip.hpp"
22 
23 namespace torc {
24 namespace physical {
25 
26 BOOST_AUTO_TEST_SUITE(physical)
27 
28 /// \brief Unit test for the Routethrough class.
29 BOOST_AUTO_TEST_CASE(RouteThroughUnitTest) {
30  // create an accessory instance
31  InstanceSharedPtr instancePtr = Factory::newInstancePtr("name", "type", "tile", "site",
33  BOOST_REQUIRE(instancePtr.get() != 0);
34 
35  // functions tested:
36  // Routethrough(const string& inSetting, const string& inName, const string& inValue,
37  // const InstanceWeakPtr& inInstancePtr, const string& inSourceWireName,
38  // const string& inSinkWireName);
39  std::string setting = "_ROUTETHROUGH";
40  std::string name = "name";
41  std::string value = "value";
42  std::string source = "source";
43  std::string sink = "sink";
44  Routethrough routethrough(setting, name, value, instancePtr, source, sink);
45 
46  // functions tested:
47  // const string& getSetting(void) const;
48  // const InstanceWeakPtr& getInstancePtr(void) const;
49  // const WireName& getSourceWireName(void) const;
50  // const WireName& getSinkWireName(void) const;
51  BOOST_CHECK_EQUAL(routethrough.getSetting(), setting);
52  BOOST_CHECK_EQUAL(routethrough.getSourceWireName(), source);
53  BOOST_CHECK_EQUAL(routethrough.getSinkWireName(), sink);
54  BOOST_CHECK(routethrough.getInstancePtr().lock() == instancePtr);
55 }
56 
57 BOOST_AUTO_TEST_SUITE_END()
58 
59 } // namespace physical
60 } // namespace torc
const WireName & getSinkWireName(void) const
Returns the instance sink wire name.
const string & getSetting(void) const
Returns the _ROUTETHROUGH setting.
std::string string
BOOST_AUTO_TEST_CASE(XdlUnpackUnitTest)
Unit test for the XdlUnpack class.
const WireName & getSourceWireName(void) const
Returns the instance source wire name.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
Header for the Pip class.
Header for the Factory class.
const InstanceWeakPtr & getInstancePtr(void) const
Returns the instance weak pointer.