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/ArcUnitTest.cpp $ 00003 // $Id: ArcUnitTest.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 Arc class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/Arc.hpp" 00021 #include <iostream> 00022 00023 namespace torc { 00024 namespace architecture { 00025 00026 BOOST_AUTO_TEST_SUITE(architecture) 00027 00028 /// \brief Unit test for the Arc class. 00029 BOOST_AUTO_TEST_CASE(ArcUnitTest) { 00030 // supporting variables 00031 Tilewire tilewire1(xilinx::TileIndex(5), xilinx::WireIndex(3)); 00032 Tilewire tilewire2(xilinx::TileIndex(0), xilinx::WireIndex(9)); 00033 00034 // members tested: 00035 // Tilewire mSourceTilewire; 00036 // Tilewire mSinkTilewire; 00037 // functions tested: 00038 // Arc(void); 00039 // Arc(const Tilewire& inSourceTilewire, const Tilewire& inSinkTilewire); 00040 // bool operator ==(const Arc& rhs) const; 00041 // bool isUndefined(void) const; 00042 Arc arc1; 00043 Arc arc2; 00044 Arc arc3(tilewire1, tilewire2); 00045 BOOST_CHECK((arc1 == arc2) == true); 00046 BOOST_CHECK((arc1 == arc3) == false); 00047 BOOST_CHECK(arc1.isUndefined()); 00048 00049 // functions tested: 00050 // const Tilewire& getSourceTilewire(void) const; 00051 // const Tilewire& getSinkTilewire(void) const; 00052 BOOST_CHECK(arc3.getSourceTilewire() == tilewire1); 00053 BOOST_CHECK(arc3.getSinkTilewire() == tilewire2); 00054 00055 // functions tested: 00056 // friend std::size_t hash_value(const Arc& inArc); 00057 BOOST_CHECK_EQUAL(hash_value(arc1), hash_value(arc2)); 00058 } 00059 00060 BOOST_AUTO_TEST_SUITE_END() 00061 00062 } // namespace architecture 00063 } // namespace torc