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/DDBStreamHelperUnitTest.cpp $ 00003 // $Id: DDBStreamHelperUnitTest.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 DDBStreamHelper class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/DDB.hpp" 00021 #include "torc/architecture/DDBStreamHelper.hpp" 00022 #include "torc/architecture/OutputStreamHelpers.hpp" 00023 #include <sstream> 00024 00025 namespace torc { 00026 namespace architecture { 00027 00028 using namespace torc::architecture::xilinx; 00029 00030 BOOST_AUTO_TEST_SUITE(architecture) 00031 00032 /// \brief Unit test for the DDBStreamHelper class. 00033 BOOST_AUTO_TEST_CASE(DDBStreamHelperUnitTest) { 00034 // functions tested: 00035 // static IWordIndex getIWordIndex(std::ostream& os); 00036 // static const class DDB* getDDBPtr(std::ostream& os); 00037 DDB ddb("xc2vp2"); 00038 std::stringstream s; 00039 s << ddb; 00040 BOOST_CHECK(DDBStreamHelper::getIWordIndex(s) != 0); 00041 BOOST_CHECK(DDBStreamHelper::getDDBPtr(s) == &ddb); 00042 00043 // functions tested: 00044 // std::ostream& operator <<(std::ostream& os, const DDB& ddb); 00045 s << ddb << Tilewire(TileIndex(1), WireIndex(0)); 00046 BOOST_CHECK_EQUAL(s.str(), "CNR_TBTERM_N6A1@[0,1] CNR_TTERM \"LIOITTERM\" (0@1)"); 00047 } 00048 00049 BOOST_AUTO_TEST_SUITE_END() 00050 00051 } // namespace architecture 00052 } // namespace torc 00053