torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveConnUnitTest.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 PrimitiveConn class.
18 
19 #include <boost/test/unit_test.hpp>
21 
22 namespace torc {
23 namespace architecture {
24 
25 BOOST_AUTO_TEST_SUITE(architecture)
26 
27 /// \brief Unit test for the PrimitiveConn class.
28 BOOST_AUTO_TEST_CASE(PrimitiveConnUnitTest) {
29  // members tested:
30  // const PrimitiveElementPin* mSourcePtr;
31  // PrimitiveElementPinPtrVector mSinks;
32  // functions tested:
33  // const PrimitiveElementPin* getSourcePtr(void) const
34  // const PrimitiveElementPinPtrVector& getSinks(void) const
38  PrimitiveConn conn;
39  conn.mSourcePtr = &pin1;
40  conn.mSinks.push_back(&pin2);
41  conn.mSinks.push_back(&pin3);
42  BOOST_CHECK_EQUAL(conn.getSourcePtr(), &pin1);
43  const PrimitiveElementPinPtrVector& sinks = conn.getSinks();
44  PrimitiveElementPinPtrVector::const_iterator p = sinks.begin();
45  BOOST_CHECK_EQUAL(*p++, &pin2);
46  BOOST_CHECK_EQUAL(*p++, &pin3);
47  BOOST_CHECK(p == sinks.end());
48 }
49 
50 BOOST_AUTO_TEST_SUITE_END()
51 
52 } // namespace architecture
53 } // namespace torc
const PrimitiveElementPin * mSourcePtr
Pointer to the source primitive element pin.
const PrimitiveElementPinPtrVector & getSinks(void) const
Returns a vector of pointers to the sink primitive element pins.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
Definition: ArcUnitTest.cpp:29
const PrimitiveElementPin * getSourcePtr(void) const
Returns a pointer to the source primitive element pin.
PrimitiveElementPinPtrVector mSinks
Vector of pointers to the sink primitive element pins.
Encapsulation of a PrimitiveDef internal connection. This class is analogous to a permanent net with...
Header for the PrimitiveConn class.
Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins ...
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers.