00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/physical/RoutethroughUnitTest.cpp $ 00003 // $Id: RoutethroughUnitTest.cpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Unit test for the Routethrough class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/physical/Factory.hpp" 00021 #include "torc/physical/Pip.hpp" 00022 00023 namespace torc { 00024 namespace physical { 00025 00026 BOOST_AUTO_TEST_SUITE(physical) 00027 00028 /// \brief Unit test for the Routethrough class. 00029 BOOST_AUTO_TEST_CASE(RouteThroughUnitTest) { 00030 // create an accessory instance 00031 InstanceSharedPtr instancePtr = Factory::newInstancePtr("name", "type", "tile", "site", 00032 eInstanceBondingUnknown); 00033 BOOST_REQUIRE(instancePtr.get() != 0); 00034 00035 // functions tested: 00036 // Routethrough(const string& inSetting, const string& inName, const string& inValue, 00037 // const InstanceWeakPtr& inInstancePtr, const string& inSourceWireName, 00038 // const string& inSinkWireName); 00039 std::string setting = "_ROUTETHROUGH"; 00040 std::string name = "name"; 00041 std::string value = "value"; 00042 std::string source = "source"; 00043 std::string sink = "sink"; 00044 Routethrough routethrough(setting, name, value, instancePtr, source, sink); 00045 00046 // functions tested: 00047 // const string& getSetting(void) const; 00048 // const InstanceWeakPtr& getInstancePtr(void) const; 00049 // const WireName& getSourceWireName(void) const; 00050 // const WireName& getSinkWireName(void) const; 00051 BOOST_CHECK_EQUAL(routethrough.getSetting(), setting); 00052 BOOST_CHECK_EQUAL(routethrough.getSourceWireName(), source); 00053 BOOST_CHECK_EQUAL(routethrough.getSinkWireName(), sink); 00054 BOOST_CHECK(routethrough.getInstancePtr().lock() == instancePtr); 00055 } 00056 00057 BOOST_AUTO_TEST_SUITE_END() 00058 00059 } // namespace physical 00060 } // namespace torc