102{
103 mmapArray2Bit_t testVector;
104
105
106 if(unlink(TEST_FILE_NAME) == 0)
107 {
108
109 }
110
111 check(m_failures, ++m_testNum, "Create 2 bit vector file", 0,
112 testVector.
create(TEST_FILE_NAME, 11));
113
114 testVector.set(0,0);
115 testVector.set(1,1);
116 testVector.set(2,2);
117 testVector.set(3,3);
118 testVector.set(4,3);
119 testVector.set(5,2);
120 testVector.set(6,1);
121 testVector.set(7,0);
122 testVector.set(8,2);
123 testVector.set(9,1);
124 testVector.set(10,3);
125 check(m_failures, ++m_testNum, "Access 2 bit element 0", 0U, testVector[0]);
126 check(m_failures, ++m_testNum, "Access 2 bit element 1", 1U, testVector[1]);
127 check(m_failures, ++m_testNum, "Access 2 bit element 2", 2U, testVector[2]);
128 check(m_failures, ++m_testNum, "Access 2 bit element 3", 3U, testVector[3]);
129 check(m_failures, ++m_testNum, "Access 2 bit element 4", 3U, testVector[4]);
130 check(m_failures, ++m_testNum, "Access 2 bit element 5", 2U, testVector[5]);
131 check(m_failures, ++m_testNum, "Access 2 bit element 6", 1U, testVector[6]);
132 check(m_failures, ++m_testNum, "Access 2 bit element 7", 0U, testVector[7]);
133 check(m_failures, ++m_testNum, "Access 2 bit element 8", 2U, testVector[8]);
134 check(m_failures, ++m_testNum, "Access 2 bit element 9", 1U, testVector[9]);
135 check(m_failures, ++m_testNum, "Access 2 bit element 10", 3U, testVector[10]);
136 check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
137 check(m_failures, ++m_testNum,
"Re-open vector file",
false, testVector.
open(TEST_FILE_NAME));
138 check(m_failures, ++m_testNum, "Access 2 bit element 0", 0U, testVector[0]);
139 check(m_failures, ++m_testNum, "Access 2 bit element 1", 1U, testVector[1]);
140 check(m_failures, ++m_testNum, "Access 2 bit element 2", 2U, testVector[2]);
141 check(m_failures, ++m_testNum, "Access 2 bit element 3", 3U, testVector[3]);
142 check(m_failures, ++m_testNum, "Access 2 bit element 4", 3U, testVector[4]);
143 check(m_failures, ++m_testNum, "Access 2 bit element 5", 2U, testVector[5]);
144 check(m_failures, ++m_testNum, "Access 2 bit element 6", 1U, testVector[6]);
145 check(m_failures, ++m_testNum, "Access 2 bit element 7", 0U, testVector[7]);
146 check(m_failures, ++m_testNum, "Access 2 bit element 8", 2U, testVector[8]);
147 check(m_failures, ++m_testNum, "Access 2 bit element 9", 1U, testVector[9]);
148 check(m_failures, ++m_testNum, "Access 2 bit element 10", 3U, testVector[10]);
149
150 check(m_failures, ++m_testNum, "Close vector file", false, testVector.close());
151 check(m_failures, ++m_testNum, "Unlink vector file", 0, unlink(TEST_FILE_NAME));
152
153}
bool open(const char *file, int flags=O_RDONLY)
open a previously created mapped vector
int create(const char *file, indexT elementCount, int optionalHeaderCount=0)
Create a vector with elementCount memebers.