21 #include "PackedVector.h" 44 void PackedArrayTest::testBool(
void)
48 testVector.resize(11);
60 check(m_failures, ++m_testNum,
"Access 1 bit element 0", 0U, testVector[0]);
61 check(m_failures, ++m_testNum,
"Access 1 bit element 1", 1U, testVector[1]);
62 check(m_failures, ++m_testNum,
"Access 1 bit element 2", 0U, testVector[2]);
63 check(m_failures, ++m_testNum,
"Access 1 bit element 3", 1U, testVector[3]);
64 check(m_failures, ++m_testNum,
"Access 1 bit element 4", 1U, testVector[4]);
65 check(m_failures, ++m_testNum,
"Access 1 bit element 5", 0U, testVector[5]);
66 check(m_failures, ++m_testNum,
"Access 1 bit element 6", 1U, testVector[6]);
67 check(m_failures, ++m_testNum,
"Access 1 bit element 7", 0U, testVector[7]);
68 check(m_failures, ++m_testNum,
"Access 1 bit element 8", 0U, testVector[8]);
69 check(m_failures, ++m_testNum,
"Access 1 bit element 9", 0U, testVector[9]);
70 check(m_failures, ++m_testNum,
"Access 1 bit element 10", 1U, testVector[10]);
73 void PackedArrayTest::test2Bit(
void)
77 testVector.resize(11);
89 check(m_failures, ++m_testNum,
"Access 2 bit element 0", 0U, testVector[0]);
90 check(m_failures, ++m_testNum,
"Access 2 bit element 1", 1U, testVector[1]);
91 check(m_failures, ++m_testNum,
"Access 2 bit element 2", 2U, testVector[2]);
92 check(m_failures, ++m_testNum,
"Access 2 bit element 3", 3U, testVector[3]);
93 check(m_failures, ++m_testNum,
"Access 2 bit element 4", 3U, testVector[4]);
94 check(m_failures, ++m_testNum,
"Access 2 bit element 5", 2U, testVector[5]);
95 check(m_failures, ++m_testNum,
"Access 2 bit element 6", 1U, testVector[6]);
96 check(m_failures, ++m_testNum,
"Access 2 bit element 7", 0U, testVector[7]);
97 check(m_failures, ++m_testNum,
"Access 2 bit element 8", 2U, testVector[8]);
98 check(m_failures, ++m_testNum,
"Access 2 bit element 9", 1U, testVector[9]);
99 check(m_failures, ++m_testNum,
"Access 2 bit element 10", 3U, testVector[10]);
102 void PackedArrayTest::test4Bit(
void)
106 testVector.resize(11);
117 testVector.set(10,10);
119 check(m_failures, ++m_testNum,
"Access 4 bit element 0", 0U, testVector[0]);
120 check(m_failures, ++m_testNum,
"Access 4 bit element 1", 1U, testVector[1]);
121 check(m_failures, ++m_testNum,
"Access 4 bit element 2", 2U, testVector[2]);
122 check(m_failures, ++m_testNum,
"Access 4 bit element 3", 3U, testVector[3]);
123 check(m_failures, ++m_testNum,
"Access 4 bit element 4", 4U, testVector[4]);
124 check(m_failures, ++m_testNum,
"Access 4 bit element 5", 5U, testVector[5]);
125 check(m_failures, ++m_testNum,
"Access 4 bit element 6", 6U, testVector[6]);
126 check(m_failures, ++m_testNum,
"Access 4 bit element 7", 7U, testVector[7]);
127 check(m_failures, ++m_testNum,
"Access 4 bit element 8", 8U, testVector[8]);
128 check(m_failures, ++m_testNum,
"Access 4 bit element 9", 9U, testVector[9]);
129 check(m_failures, ++m_testNum,
"Access 4 bit element 10", 10U, testVector[10]);
132 void PackedArrayTest::testResize(
void)
136 testVector.resize(0);
137 check(m_failures, ++m_testNum,
"New size is 0", 0U, testVector.size());
139 testVector.push_back(0);
140 testVector.push_back(1);
141 testVector.push_back(2);
142 testVector.push_back(3);
143 testVector.push_back(4);
144 testVector.push_back(5);
145 testVector.push_back(6);
146 testVector.push_back(7);
147 testVector.push_back(8);
148 testVector.push_back(9);
149 testVector.push_back(10);
151 check(m_failures, ++m_testNum,
"New size is 11", 11U, testVector.size());
153 check(m_failures, ++m_testNum,
"Access 4 bit element 0", 0U, testVector[0]);
154 check(m_failures, ++m_testNum,
"Access 4 bit element 1", 1U, testVector[1]);
155 check(m_failures, ++m_testNum,
"Access 4 bit element 2", 2U, testVector[2]);
156 check(m_failures, ++m_testNum,
"Access 4 bit element 3", 3U, testVector[3]);
157 check(m_failures, ++m_testNum,
"Access 4 bit element 4", 4U, testVector[4]);
158 check(m_failures, ++m_testNum,
"Access 4 bit element 5", 5U, testVector[5]);
159 check(m_failures, ++m_testNum,
"Access 4 bit element 6", 6U, testVector[6]);
160 check(m_failures, ++m_testNum,
"Access 4 bit element 7", 7U, testVector[7]);
161 check(m_failures, ++m_testNum,
"Access 4 bit element 8", 8U, testVector[8]);
162 check(m_failures, ++m_testNum,
"Access 4 bit element 9", 9U, testVector[9]);
163 check(m_failures, ++m_testNum,
"Access 4 bit element 10", 10U, testVector[10]);
166 int main(
int argc,
char **argv)
170 bool showAllCasesFlag =
false;
173 while(( opt = getopt(argc, (
char **) argv,
"v")) != -1) {
176 showAllCasesFlag =
true;
179 std::cerr <<
"usage: testSW [-v]" << std::endl;
190 exit(test.getFailureCount());