150 {
152 tracked_storage1 storage1_1;
161 BOOST_CHECK_EQUAL( storage1_1.memory_size(), 40);
162 BOOST_CHECK_EQUAL( storage1_1.index().size(), 8);
163
167 storage1_1.write(out);
168
170 tracked_storage2 storage2_1;
173 BOOST_CHECK_EQUAL( storage2_1.memory_size(), 7);
174 BOOST_CHECK_EQUAL( storage2_1.index().size(), 1);
175
176 storage2_1.write(out);
177
178 out.flush();
179 out.close();
180
183 BOOST_CHECK_EQUAL( version, 5 );
184 auto ds = content.create_datastream();
185 tracked_storage1 storage1_2;
186 BOOST_CHECK(storage1_2.read(ds, 500));
187 BOOST_CHECK_EQUAL( storage1_2.index().size(), 8);
188 const auto& primary_idx1_2 = storage1_2.index().get<by_key>();
189 auto itr2 = primary_idx1_2.cbegin();
190 BOOST_CHECK_EQUAL( itr2->key, 0);
191 BOOST_CHECK_EQUAL( itr2->s, 6);
192 BOOST_CHECK_EQUAL( (++itr2)->key, 3);
193 BOOST_CHECK_EQUAL( itr2->s, 7);
194 BOOST_CHECK_EQUAL( (++itr2)->key, 5);
195 BOOST_CHECK_EQUAL( itr2->s, 3);
196 BOOST_CHECK_EQUAL( (++itr2)->key, 9);
197 BOOST_CHECK_EQUAL( itr2->s, 4);
198 BOOST_CHECK_EQUAL( (++itr2)->key, 15);
199 BOOST_CHECK_EQUAL( itr2->s, 6);
200 BOOST_CHECK_EQUAL( (++itr2)->key, 16);
201 BOOST_CHECK_EQUAL( itr2->s, 4);
202 BOOST_CHECK_EQUAL( (++itr2)->key, 19);
203 BOOST_CHECK_EQUAL( itr2->s, 3);
204 BOOST_CHECK_EQUAL( (++itr2)->key, 25);
205 BOOST_CHECK_EQUAL( itr2->s, 7);
206 BOOST_CHECK_EQUAL( storage1_2.memory_size(), 40);
207
208 tracked_storage2 storage2_2;
209 BOOST_CHECK(storage2_2.read(ds, 500));
210 BOOST_CHECK_EQUAL( storage2_2.index().size(), 1);
211 const auto& primary_idx2_2 = storage2_2.index().get<by_key>();
212 auto itr3 = primary_idx2_2.cbegin();
213 BOOST_CHECK_EQUAL( itr3->key, 3);
214 BOOST_CHECK( itr3->time == now);
215 BOOST_CHECK_EQUAL( itr3->s, 7);
216
217 const auto tellp = content.tellp();
218 content.seek_end(0);
219 BOOST_CHECK_EQUAL( content.tellp(), tellp );
220}