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/PrimitiveElementPinUnitTest.cpp $ 00003 // $Id: PrimitiveElementPinUnitTest.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 PrimitiveElementPin class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/PrimitiveElementPin.hpp" 00021 00022 namespace torc { 00023 namespace architecture { 00024 00025 BOOST_AUTO_TEST_SUITE(architecture) 00026 00027 /// \brief Unit test for the PrimitiveElementPin class. 00028 BOOST_AUTO_TEST_CASE(PrimitiveElementPinUnitTest) { 00029 /// \todo Test mPrimitiveConn and getPrimitiveConn. Do a better job testing mElementPtr and 00030 /// getElementPtr. 00031 // members not tested: 00032 // const PrimitiveConnSharedPtr mPrimitiveConn; 00033 // functions not tested: 00034 // const PrimitiveConnSharedPtr getPrimitiveConn(void) const { return mPrimitiveConn; } 00035 00036 // members tested: 00037 // const PrimitiveElement* mElementPtr; 00038 // string mName; 00039 // PinFlags mFlags; 00040 // functions tested: 00041 // PrimitiveElementPin(const string& inName, PinFlags inFlags); 00042 // const PrimitiveElement* getElementPtr(void) const; 00043 // const string& getName(void) const; 00044 // PinFlags getFlags(void) const; 00045 // PrimitiveElementPin(void); 00046 // bool isInput(void) const; 00047 // bool isOutput(void) const; 00048 std::string name = "name"; 00049 xilinx::PinFlags flags(PinDirection::ePinDirectionOutput); 00050 PrimitiveElementPin pin1(0, name, flags); 00051 BOOST_CHECK_EQUAL(pin1.getElementPtr(), static_cast<void*>(0)); 00052 BOOST_CHECK_EQUAL(pin1.getName(), name); 00053 BOOST_CHECK_EQUAL(pin1.getFlags(), flags); 00054 BOOST_CHECK(pin1.isInput() == false); 00055 BOOST_CHECK(pin1.isOutput() == true); 00056 PrimitiveElementPin pin2; 00057 BOOST_CHECK_EQUAL(pin2.getElementPtr(), static_cast<void*>(0)); 00058 BOOST_CHECK_EQUAL(pin2.getName(), ""); 00059 BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0)); 00060 BOOST_CHECK(pin2.isInput() == false); 00061 BOOST_CHECK(pin2.isOutput() == false); 00062 } 00063 00064 BOOST_AUTO_TEST_SUITE_END() 00065 00066 } // namespace architecture 00067 } // namespace torc