Home | History | Annotate | Download | only in tests

Lines Matching refs:vec

23   marisa_alpha::Vector<int> vec;
25 ASSERT(vec.max_size() == MARISA_ALPHA_UINT32_MAX);
26 ASSERT(vec.size() == 0);
27 ASSERT(vec.capacity() == 0);
28 ASSERT(!vec.fixed());
29 ASSERT(vec.empty());
30 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32));
33 vec.push_back(values[i]);
34 ASSERT(vec[i] == values[i]);
35 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec)[i] ==
39 ASSERT(vec.size() == values.size());
40 ASSERT(vec.capacity() >= vec.size());
41 ASSERT(!vec.empty());
42 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32)
45 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec).front()
47 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec).back()
49 ASSERT(vec.front() == values.front());
50 ASSERT(vec.back() == values.back());
52 vec.shrink();
54 ASSERT(vec.size() == values.size());
55 ASSERT(vec.capacity() == vec.size());
57 ASSERT(vec[i] == values[i]);
58 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec)[i] ==
62 vec.save("vector-test.dat");
63 vec.clear();
65 ASSERT(vec.empty());
66 ASSERT(vec.capacity() == 0);
69 vec.mmap(&mapper, "vector-test.dat");
72 ASSERT(vec.size() == values.size());
73 ASSERT(vec.capacity() == 0);
74 ASSERT(vec.fixed());
75 ASSERT(!vec.empty());
76 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32)
80 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec)[i] ==
84 vec.clear();
85 vec.load("vector-test.dat");
87 ASSERT(vec.size() == values.size());
88 ASSERT(vec.capacity() == vec.size());
89 ASSERT(!vec.fixed());
90 ASSERT(!vec.empty());
91 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32)
95 ASSERT(vec[i] == values[i]);
96 ASSERT(static_cast<const marisa_alpha::Vector<int> &>(vec)[i] ==
100 vec.clear();
102 vec.push_back(0);
103 ASSERT(vec.capacity() == 1);
104 vec.push_back(1);
105 ASSERT(vec.capacity() == 2);
106 vec.push_back(2);
107 ASSERT(vec.capacity() == 4);
108 vec.resize(5);
109 ASSERT(vec.capacity() == 8);
110 vec.resize(100);
111 ASSERT(vec.capacity() == 100);
113 vec.fix();
114 ASSERT(vec.fixed());
115 EXCEPT(vec.fix(), MARISA_ALPHA_STATE_ERROR);
116 EXCEPT(vec.push_back(0), MARISA_ALPHA_STATE_ERROR);
117 EXCEPT(vec.resize(0), MARISA_ALPHA_STATE_ERROR);
118 EXCEPT(vec.reserve(0), MARISA_ALPHA_STATE_ERROR);
126 marisa_alpha::IntVector vec;
128 ASSERT(vec.num_bits_per_int() == 0);
129 ASSERT(vec.mask() == 0);
130 ASSERT(vec.size() == 0);
131 ASSERT(vec.empty());
132 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32) * 4);
135 vec.build(values);
137 ASSERT(vec.num_bits_per_int() == 1);
138 ASSERT(vec.mask() == 1);
139 ASSERT(vec.size() == 0);
140 ASSERT(vec.empty());
141 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32) * 4);
144 vec.build(values);
146 ASSERT(vec.num_bits_per_int() == 1);
147 ASSERT(vec.mask() == 1);
148 ASSERT(vec.size() == 1);
149 ASSERT(!vec.empty());
150 ASSERT(vec.total_size() == sizeof(marisa_alpha::UInt32) * 5);
151 ASSERT(vec[0] == 0);
154 vec.build(values);
156 ASSERT(vec.num_bits_per_int() == 8);
157 ASSERT(vec.mask() == 0xFF);
158 ASSERT(vec.size() == 2);
159 ASSERT(vec[0] == 0);
160 ASSERT(vec[1] == 255);
163 vec.build(values);
165 ASSERT(vec.num_bits_per_int() == 17);
166 ASSERT(vec.mask() == 0x1FFFF);
167 ASSERT(vec.size() == 3);
168 ASSERT(vec[0] == 0);
169 ASSERT(vec[1] == 255);
170 ASSERT(vec[2] == 65536);
172 vec.save("vector-test.dat");
173 vec.clear();
175 ASSERT(vec.num_bits_per_int() == 0);
176 ASSERT(vec.mask() == 0);
177 ASSERT(vec.size() == 0);
180 vec.mmap(&mapper, "vector-test.dat");
183 ASSERT(vec.num_bits_per_int() == 17);
184 ASSERT(vec.mask() == 0x1FFFF);
185 ASSERT(vec.size() == 3);
186 ASSERT(vec[0] == 0);
187 ASSERT(vec[1] == 255);
188 ASSERT(vec[2] == 65536);
190 vec.clear();
191 vec.load("vector-test.dat");
193 ASSERT(vec.num_bits_per_int() == 17);
194 ASSERT(vec.mask() == 0x1FFFF);
195 ASSERT(vec.size() == 3);
196 ASSERT(vec[0] == 0);
197 ASSERT(vec[1] == 255);
198 ASSERT(vec[2] == 65536);
204 vec.build(values);
206 ASSERT(vec.size() == values.size());
207 for (std::size_t i = 0; i < vec.size(); ++i) {
208 ASSERT(vec[i] == values[i]);