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/architecture/PrimitiveConnUnitTest.cpp $ 00003 // $Id: PrimitiveConnUnitTest.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 PrimitiveConn class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/PrimitiveConn.hpp" 00021 00022 namespace torc { 00023 namespace architecture { 00024 00025 BOOST_AUTO_TEST_SUITE(architecture) 00026 00027 /// \brief Unit test for the PrimitiveConn class. 00028 BOOST_AUTO_TEST_CASE(PrimitiveConnUnitTest) { 00029 // members tested: 00030 // const PrimitiveElementPin* mSourcePtr; 00031 // PrimitiveElementPinPtrVector mSinks; 00032 // functions tested: 00033 // const PrimitiveElementPin* getSourcePtr(void) const 00034 // const PrimitiveElementPinPtrVector& getSinks(void) const 00035 PrimitiveElementPin pin1; 00036 PrimitiveElementPin pin2; 00037 PrimitiveElementPin pin3; 00038 PrimitiveConn conn; 00039 conn.mSourcePtr = &pin1; 00040 conn.mSinks.push_back(&pin2); 00041 conn.mSinks.push_back(&pin3); 00042 BOOST_CHECK_EQUAL(conn.getSourcePtr(), &pin1); 00043 const PrimitiveElementPinPtrVector& sinks = conn.getSinks(); 00044 PrimitiveElementPinPtrVector::const_iterator p = sinks.begin(); 00045 BOOST_CHECK_EQUAL(*p++, &pin2); 00046 BOOST_CHECK_EQUAL(*p++, &pin3); 00047 BOOST_CHECK(p == sinks.end()); 00048 } 00049 00050 BOOST_AUTO_TEST_SUITE_END() 00051 00052 } // namespace architecture 00053 } // namespace torc