libStatGen Software 1
Loading...
Searching...
No Matches
PackedArrayTest Class Reference
Inheritance diagram for PackedArrayTest:
Collaboration diagram for PackedArrayTest:

Public Member Functions

 PackedArrayTest (const char *title)
 
void testBool ()
 
void test2Bit ()
 
void test4Bit ()
 
void testResize ()
 
void test ()
 
- Public Member Functions inherited from UnitTest
 UnitTest (const char *title)
 
void test ()
 
int getPassCount ()
 
int getFailureCount ()
 
const std::string getTitle () const
 
 UnitTest (const char *title)
 
void test ()
 
int getPassCount ()
 
int getFailureCount ()
 
const std::string getTitle () const
 

Additional Inherited Members

- Protected Attributes inherited from UnitTest
std::string m_title
 
int m_failures
 
int m_testNum
 

Detailed Description

Definition at line 27 of file PackedVectorTest.cpp.

Constructor & Destructor Documentation

◆ PackedArrayTest()

PackedArrayTest::PackedArrayTest ( const char *  title)
inline

Definition at line 30 of file PackedVectorTest.cpp.

30: UnitTest(title) {;}

Member Function Documentation

◆ test()

void PackedArrayTest::test ( )
inline

Definition at line 36 of file PackedVectorTest.cpp.

36 {
37 testBool();
38 test2Bit();
39 test4Bit();
40 testResize();
41 }

◆ test2Bit()

void PackedArrayTest::test2Bit ( void  )

Definition at line 73 of file PackedVectorTest.cpp.

74{
75 PackedVector2Bit_t testVector;
76
77 testVector.resize(11);
78 testVector.set(0,0);
79 testVector.set(1,1);
80 testVector.set(2,2);
81 testVector.set(3,3);
82 testVector.set(4,3);
83 testVector.set(5,2);
84 testVector.set(6,1);
85 testVector.set(7,0);
86 testVector.set(8,2);
87 testVector.set(9,1);
88 testVector.set(10,3);
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]);
100}

◆ test4Bit()

void PackedArrayTest::test4Bit ( void  )

Definition at line 102 of file PackedVectorTest.cpp.

103{
104 PackedVector4Bit_t testVector;
105
106 testVector.resize(11);
107 testVector.set(0,0);
108 testVector.set(1,1);
109 testVector.set(2,2);
110 testVector.set(3,3);
111 testVector.set(4,4);
112 testVector.set(5,5);
113 testVector.set(6,6);
114 testVector.set(7,7);
115 testVector.set(8,8);
116 testVector.set(9,9);
117 testVector.set(10,10);
118
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]);
130}

◆ testBool()

void PackedArrayTest::testBool ( void  )

Definition at line 44 of file PackedVectorTest.cpp.

45{
46 PackedVectorBool_t testVector;
47
48 testVector.resize(11);
49 testVector.set(0,0);
50 testVector.set(1,1);
51 testVector.set(2,0);
52 testVector.set(3,1);
53 testVector.set(4,1);
54 testVector.set(5,0);
55 testVector.set(6,1);
56 testVector.set(7,0);
57 testVector.set(8,0);
58 testVector.set(9,0);
59 testVector.set(10,1);
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]);
71}

◆ testResize()

void PackedArrayTest::testResize ( void  )

Definition at line 132 of file PackedVectorTest.cpp.

133{
134 PackedVector4Bit_t testVector;
135
136 testVector.resize(0);
137 check(m_failures, ++m_testNum, "New size is 0", 0U, testVector.size());
138
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);
150
151 check(m_failures, ++m_testNum, "New size is 11", 11U, testVector.size());
152
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]);
164}

The documentation for this class was generated from the following file: