torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitivePinUnitTest.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 PrimitivePin 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 PrimitivePin class.
28 BOOST_AUTO_TEST_CASE(PrimitivePinUnitTest) {
29  // members tested:
30  // string mName;
31  // PinFlags mFlags;
32  // functions tested:
33  // PrimitivePin(const string& inName, PinFlags inFlags);
34  // const string& getName(void) const;
35  // PinFlags getFlags(void) const;
36  // PrimitivePin(void);
37  // bool isInput(void) const;
38  // bool isOutput(void) const;
39  std::string name = "name";
41  PrimitivePin pin1(name, flags);
42  BOOST_CHECK_EQUAL(pin1.getName(), name);
43  BOOST_CHECK_EQUAL(pin1.getFlags(), flags);
44  BOOST_CHECK(pin1.isInput() == false);
45  BOOST_CHECK(pin1.isOutput() == true);
46  PrimitivePin pin2;
47  BOOST_CHECK_EQUAL(pin2.getName(), "");
48  BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0));
49  BOOST_CHECK(pin2.isInput() == false);
50  BOOST_CHECK(pin2.isOutput() == false);
51 }
52 
53 BOOST_AUTO_TEST_SUITE_END()
54 
55 } // namespace architecture
56 } // namespace torc
bool isOutput(void) const
Returns true if this pin is a primitive output.
PinFlags getFlags(void) const
Returns the pin direction flags.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
Definition: ArcUnitTest.cpp:29
bool isInput(void) const
Returns true if this pin is a primitive input.
const string & getName(void) const
Returns the pin name.
std::string string
Header for the PrimitivePin class.
Encapsulation of pin attribute flags in an unsigned 16-bit integer.
Encapsulation of a primitive pin's name and flags. Primitive pins are logic site inputs or outputs...