torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TileInfoUnitTest.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 TileInfo 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 TileInfo class.
28 BOOST_AUTO_TEST_CASE(TileInfoUnitTest) {
29  // functions tested:
30  // friend uint32_t distance(const TileInfo& inA, const TileInfo& inB);
31  // create a few TileInfo objects
33  typedef xilinx::TileRow TileRow;
34  typedef xilinx::TileCol TileCol;
35  TileInfo tileInfo1; tileInfo1.set(TileTypeIndex(1), TileRow( 0), TileCol( 0), "tile1");
36  TileInfo tileInfo2; tileInfo2.set(TileTypeIndex(2), TileRow(10), TileCol(10), "tile2");
37  TileInfo tileInfo3; tileInfo3.set(TileTypeIndex(3), TileRow(30), TileCol( 0), "tile3");
38  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo2), uint32_t(20));
39  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo2),
40  manhattanDistance(tileInfo2, tileInfo1));
41  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo3), uint32_t(30));
42  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo1, tileInfo3),
43  manhattanDistance(tileInfo3, tileInfo1));
44  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo2, tileInfo3), uint32_t(30));
45  BOOST_CHECK_EQUAL(manhattanDistance(tileInfo2, tileInfo3),
46  manhattanDistance(tileInfo3, tileInfo2));
47 }
48 
49 BOOST_AUTO_TEST_SUITE_END()
50 
51 BOOST_AUTO_TEST_SUITE(regression)
52 BOOST_AUTO_TEST_SUITE(architecture)
53 
54 /// \brief Unit test for the TileInfo class.
55 BOOST_AUTO_TEST_CASE(TileInfoUnitTest) {
56 
57  /// \todo Write a unit test for torc::architecture::TileInfo.
58  BOOST_REQUIRE(false);
59 
60 }
61 
62 BOOST_AUTO_TEST_SUITE_END()
63 BOOST_AUTO_TEST_SUITE_END()
64 
65 } // namespace architecture
66 } // namespace torc
Encapsulation of a tile row in an unsigned 16-bit integer.
Encapsulation of a tile column in an unsigned 16-bit integer.
BOOST_AUTO_TEST_CASE(ArcUnitTest)
Unit test for the Arc class.
Definition: ArcUnitTest.cpp:29
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
void set(const TileTypeIndex &inTypeIndex, const TileRow &inRow, const TileCol &inCol, const char *inName)
Protected initializer intended for use by the Tiles class.
Definition: TileInfo.hpp:61
Encapsulation of a tile type index in an unsigned 16-bit integer.
Header for the TileInfo class.