19 #include <boost/test/unit_test.hpp>
20 #define DEBUG // test the debug functionality as well
26 namespace architecture {
28 BOOST_AUTO_TEST_SUITE(architecture)
30 using namespace torc::architecture::xilinx;
47 tilewire_array_t tilewireArray(size3);
51 bool boundsEnforced =
false;
54 Tilewire outOfRange = tilewireArray[size3];
56 }
catch(std::out_of_range oor) {
57 std::cerr <<
"Bounds checking generated message \"" << oor.what() <<
"\"" << std::endl;
58 boundsEnforced =
true;
60 BOOST_CHECK(boundsEnforced);
65 BOOST_CHECK_EQUAL(intArray.getSize(), 0u);
66 BOOST_CHECK_EQUAL(tilewireArray.getSize(), size3);
67 intArray.setSize(size5);
68 BOOST_CHECK_EQUAL(intArray.getSize(), size5);
79 int_array_t::iterator ip = intArray.begin();
80 int_array_t::iterator ie = intArray.end();
81 BOOST_CHECK(*ip++ == 0);
82 BOOST_CHECK(*ip++ == 1);
83 BOOST_CHECK(*ip++ == 2);
84 BOOST_CHECK(*ip++ == 3);
85 BOOST_CHECK(*ip++ == 4);
86 BOOST_CHECK_EQUAL(ip, ie);
95 tilewireArray[0] = tilewire1;
96 tilewireArray[1] = tilewire2;
97 tilewireArray[2] = tilewire3;
98 tilewire_array_t::const_iterator tp = tilewireArray.begin();
99 tilewire_array_t::const_iterator te = tilewireArray.end();
100 BOOST_CHECK(*tp++ == tilewireArray[0]);
101 BOOST_CHECK(*tp++ == tilewireArray[1]);
102 BOOST_CHECK(*tp++ == tilewireArray[2]);
103 BOOST_CHECK_EQUAL(tp, te);
109 int_array2d_t intArray2d(2);
110 intArray2d[0].setSize(3);
111 intArray2d[1].setSize(1);
112 intArray2d[0][0] = i++;
113 intArray2d[0][1] = i++;
114 intArray2d[0][2] = i++;
115 intArray2d[1][0] = i++;
117 int_array2d_t::const_iterator l1e = intArray2d.end();
120 int_array_t::const_iterator l2p = l1p->
begin();
121 int_array_t::const_iterator l2e = l1p->
end();
123 BOOST_CHECK_EQUAL(*l2p++, i++);
129 BOOST_AUTO_TEST_SUITE_END()
Encapsulation of a tile index in an unsigned 32-bit integer.
T * end(void)
Returns the non-constant end iterator.
Encapsulation of a wire index in an unsigned 16-bit integer.
BOOST_AUTO_TEST_CASE(TilewireUnitTest)
Unit test for the Tilewire class.
Encapsulation of a device tile and wire pair.
Encapsulation of a 2D static array.
Header for the Tilewire class.
Header for the Array class.
T * begin(void)
Returns the non-constant begin iterator.
Encapsulation of a static array.