180 {
181
182 auto data = std::vector<T>(32);
183 std::generate(data.begin(), data.end(), []() {
184 return make_random<T>();
185 });
186
187 auto uncompressed_size = data.size() *
sizeof(
T);
188 auto uncompressed_filename = create_temp_file(data.data(), uncompressed_size);
189 auto compressed_filename = create_temp_file(nullptr, 0);
190
191
193
194
197 compressed.
open(
"r");
199 const uint16_t expected_seek_point_count = 0;
200 uint16_t actual_seek_point_count = std::numeric_limits<uint16_t>::max();
201 compressed.
read(
reinterpret_cast<char*
>(&actual_seek_point_count), 2);
202 BOOST_REQUIRE_EQUAL(expected_seek_point_count, actual_seek_point_count);
203
204
205 for (size_t i = 0; i < data.size(); i++) {
206 auto actual_data = std::vector<T>(32);
208 compf.open();
209 compf.seek(i *
sizeof(
T));
210 compf.read(
reinterpret_cast<char*
>(actual_data.data()), (actual_data.size() - i) *
sizeof(
T));
211 compf.close();
212 BOOST_REQUIRE_EQUAL_COLLECTIONS(data.begin() + i, data.end(), actual_data.begin(), actual_data.end() - i);
213 }
214}
void read(char *d, size_t n)
void open(const char *mode)
void set_file_path(fc::path file_path)
uint64_t file_size(const path &p)