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/PrimitivePinUnitTest.cpp $ 00003 // $Id: PrimitivePinUnitTest.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 PrimitivePin class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/PrimitivePin.hpp" 00021 00022 namespace torc { 00023 namespace architecture { 00024 00025 BOOST_AUTO_TEST_SUITE(architecture) 00026 00027 /// \brief Unit test for the PrimitivePin class. 00028 BOOST_AUTO_TEST_CASE(PrimitivePinUnitTest) { 00029 // members tested: 00030 // string mName; 00031 // PinFlags mFlags; 00032 // functions tested: 00033 // PrimitivePin(const string& inName, PinFlags inFlags); 00034 // const string& getName(void) const; 00035 // PinFlags getFlags(void) const; 00036 // PrimitivePin(void); 00037 // bool isInput(void) const; 00038 // bool isOutput(void) const; 00039 std::string name = "name"; 00040 xilinx::PinFlags flags(PinDirection::ePinDirectionOutput); 00041 PrimitivePin pin1(name, flags); 00042 BOOST_CHECK_EQUAL(pin1.getName(), name); 00043 BOOST_CHECK_EQUAL(pin1.getFlags(), flags); 00044 BOOST_CHECK(pin1.isInput() == false); 00045 BOOST_CHECK(pin1.isOutput() == true); 00046 PrimitivePin pin2; 00047 BOOST_CHECK_EQUAL(pin2.getName(), ""); 00048 BOOST_CHECK_EQUAL(pin2.getFlags(), xilinx::PinFlags(0)); 00049 BOOST_CHECK(pin2.isInput() == false); 00050 BOOST_CHECK(pin2.isOutput() == false); 00051 } 00052 00053 BOOST_AUTO_TEST_SUITE_END() 00054 00055 } // namespace architecture 00056 } // namespace torc