torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveElementPinUnitTest.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 PrimitiveElementPin 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 PrimitiveElementPin class.
28 BOOST_AUTO_TEST_CASE(PrimitiveElementPinUnitTest) {
29  /// \todo Test mPrimitiveConn and getPrimitiveConn. Do a better job testing mElementPtr and
30  /// getElementPtr.
31  // members not tested:
32  // const PrimitiveConnSharedPtr mPrimitiveConn;
33  // functions not tested:
34  // const PrimitiveConnSharedPtr getPrimitiveConn(void) const { return mPrimitiveConn; }
35 
36  // members tested:
37  // const PrimitiveElement* mElementPtr;
38  // string mName;
39  // PinFlags mFlags;
40  // functions tested:
41  // PrimitiveElementPin(const string& inName, PinFlags inFlags);
42  // const PrimitiveElement* getElementPtr(void) const;
43  // const string& getName(void) const;
44  // PinFlags getFlags(void) const;
45  // PrimitiveElementPin(void);
46  // bool isInput(void) const;
47  // bool isOutput(void) const;
48  std::string name = "name";
50  PrimitiveElementPin pin1(0, name, flags);
51  BOOST_CHECK_EQUAL(pin1.getElementPtr(), static_cast<void*>(0));
52  BOOST_CHECK_EQUAL(pin1.getName(), name);
53  BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
54  BOOST_CHECK(pin1.isInput() == false);
55  BOOST_CHECK(pin1.isOutput() == true);
57  BOOST_CHECK_EQUAL(pin2.getElementPtr(), static_cast<void*>(0));
58  BOOST_CHECK_EQUAL(pin2.getName(), "");
59  BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
60  BOOST_CHECK(pin2.isInput() == false);
61  BOOST_CHECK(pin2.isOutput() == false);
62 }
63 
64 BOOST_AUTO_TEST_SUITE_END()
65 
66 } // namespace architecture
67 } // namespace torc
bool isOutput(void) const
Returns true if this pin is a primitive output.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
Definition: ArcUnitTest.cpp:29
PinFlags getFlags(void) const
Returns the pin direction flags.
const string & getName(void) const
Returns the pin name.
std::string string
bool isInput(void) const
Returns true if this pin is a primitive input.
const PrimitiveElement * getElementPtr(void) const
Returns a pointer to the primitive element that owns this pin.
Encapsulation of pin attribute flags in an unsigned 16-bit integer.
Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins ...
Header for the PrimitiveElementPin class.