blob: 49c5514757b6f4daa5992cd9ff75bd3bad50b65b [file] [log] [blame]
David Reissfaebedd2007-09-17 23:20:38 +00001/*
David Reissea2cba82009-03-30 21:35:00 +00002 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
David Reiss3cc9dab2010-10-06 17:10:21 +000020#define __STDC_LIMIT_MACROS
21#define __STDC_FORMAT_MACROS
22
David Reiss9a961e72010-10-06 17:10:23 +000023#ifndef _GNU_SOURCE
24#define _GNU_SOURCE // needed for getopt_long
25#endif
26
David Reiss3cc9dab2010-10-06 17:10:21 +000027#include <stdint.h>
28#include <inttypes.h>
David Reissfaebedd2007-09-17 23:20:38 +000029#include <cstddef>
David Reissfaebedd2007-09-17 23:20:38 +000030#include <fstream>
31#include <iostream>
Jake Farrell5d02b802014-01-07 21:42:01 -050032#include <thrift/cxxfunctional.h>
David Reiss3cc9dab2010-10-06 17:10:21 +000033
34#include <boost/random.hpp>
David Reiss9a961e72010-10-06 17:10:23 +000035#include <boost/shared_array.hpp>
36#include <boost/test/unit_test.hpp>
David Reiss3cc9dab2010-10-06 17:10:21 +000037
Roger Meier49ff8b12012-04-13 09:12:31 +000038#include <thrift/transport/TBufferTransports.h>
39#include <thrift/transport/TZlibTransport.h>
David Reissfaebedd2007-09-17 23:20:38 +000040
David Reiss9a961e72010-10-06 17:10:23 +000041using namespace std;
David Reiss9a961e72010-10-06 17:10:23 +000042using namespace apache::thrift::transport;
43
David Reissf2abcf92010-10-06 17:10:24 +000044boost::mt19937 rng;
David Reissfaebedd2007-09-17 23:20:38 +000045
David Reissf2abcf92010-10-06 17:10:24 +000046/*
47 * Utility code
48 */
David Reissfaebedd2007-09-17 23:20:38 +000049
David Reissf2abcf92010-10-06 17:10:24 +000050class SizeGenerator {
51 public:
52 virtual ~SizeGenerator() {}
53 virtual unsigned int getSize() = 0;
David Reissfaebedd2007-09-17 23:20:38 +000054};
55
David Reissf2abcf92010-10-06 17:10:24 +000056class ConstantSizeGenerator : public SizeGenerator {
57 public:
58 ConstantSizeGenerator(unsigned int value) : value_(value) {}
59 virtual unsigned int getSize() {
60 return value_;
61 }
62
63 private:
64 unsigned int value_;
65};
66
67class LogNormalSizeGenerator : public SizeGenerator {
68 public:
69 LogNormalSizeGenerator(double mean, double std_dev) :
Jake Farrell5d02b802014-01-07 21:42:01 -050070 gen_(rng, boost::lognormal_distribution<double>(mean, std_dev)) {}
David Reissf2abcf92010-10-06 17:10:24 +000071
72 virtual unsigned int getSize() {
73 // Loop until we get a size of 1 or more
74 while (true) {
75 unsigned int value = static_cast<unsigned int>(gen_());
76 if (value >= 1) {
77 return value;
78 }
79 }
80 }
81
82 private:
Jake Farrell5d02b802014-01-07 21:42:01 -050083 boost::variate_generator< boost::mt19937, boost::lognormal_distribution<double> > gen_;
David Reissf2abcf92010-10-06 17:10:24 +000084};
David Reiss3cc9dab2010-10-06 17:10:21 +000085
86uint8_t* gen_uniform_buffer(uint32_t buf_len, uint8_t c) {
87 uint8_t* buf = new uint8_t[buf_len];
88 memset(buf, c, buf_len);
89 return buf;
90}
91
92uint8_t* gen_compressible_buffer(uint32_t buf_len) {
93 uint8_t* buf = new uint8_t[buf_len];
94
95 // Generate small runs of alternately increasing and decreasing bytes
96 boost::uniform_smallint<uint32_t> run_length_distribution(1, 64);
97 boost::uniform_smallint<uint8_t> byte_distribution(0, UINT8_MAX);
98 boost::variate_generator< boost::mt19937, boost::uniform_smallint<uint8_t> >
99 byte_generator(rng, byte_distribution);
100 boost::variate_generator< boost::mt19937, boost::uniform_smallint<uint32_t> >
101 run_len_generator(rng, run_length_distribution);
102
103 uint32_t idx = 0;
104 int8_t step = 1;
105 while (idx < buf_len) {
106 uint32_t run_length = run_len_generator();
107 if (idx + run_length > buf_len) {
108 run_length = buf_len - idx;
109 }
110
111 uint8_t byte = byte_generator();
112 for (uint32_t n = 0; n < run_length; ++n) {
113 buf[idx] = byte;
114 ++idx;
115 byte += step;
116 }
117
118 step *= -1;
119 }
120
121 return buf;
122}
123
124uint8_t* gen_random_buffer(uint32_t buf_len) {
125 uint8_t* buf = new uint8_t[buf_len];
126
127 boost::uniform_smallint<uint8_t> distribution(0, UINT8_MAX);
128 boost::variate_generator< boost::mt19937, boost::uniform_smallint<uint8_t> >
129 generator(rng, distribution);
130
131 for (uint32_t n = 0; n < buf_len; ++n) {
132 buf[n] = generator();
133 }
134
135 return buf;
136}
David Reissfaebedd2007-09-17 23:20:38 +0000137
David Reissf2abcf92010-10-06 17:10:24 +0000138/*
139 * Test functions
140 */
141
David Reiss9a961e72010-10-06 17:10:23 +0000142void test_write_then_read(const uint8_t* buf, uint32_t buf_len) {
Roger Meier611f90c2011-12-11 22:08:51 +0000143 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
144 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reiss9a961e72010-10-06 17:10:23 +0000145 zlib_trans->write(buf, buf_len);
David Reisse94fa332010-10-06 17:10:26 +0000146 zlib_trans->finish();
David Reissfaebedd2007-09-17 23:20:38 +0000147
David Reiss9a961e72010-10-06 17:10:23 +0000148 boost::shared_array<uint8_t> mirror(new uint8_t[buf_len]);
David Reiss0a2d81e2010-10-06 17:10:40 +0000149 uint32_t got = zlib_trans->readAll(mirror.get(), buf_len);
David Reiss9a961e72010-10-06 17:10:23 +0000150 BOOST_REQUIRE_EQUAL(got, buf_len);
151 BOOST_CHECK_EQUAL(memcmp(mirror.get(), buf, buf_len), 0);
152 zlib_trans->verifyChecksum();
153}
David Reissfaebedd2007-09-17 23:20:38 +0000154
David Reiss9a961e72010-10-06 17:10:23 +0000155void test_separate_checksum(const uint8_t* buf, uint32_t buf_len) {
156 // This one is tricky. I separate the last byte of the stream out
157 // into a separate crbuf_. The last byte is part of the checksum,
158 // so the entire read goes fine, but when I go to verify the checksum
159 // it isn't there. The original implementation complained that
160 // the stream was not complete. I'm about to go fix that.
161 // It worked. Awesome.
Roger Meier611f90c2011-12-11 22:08:51 +0000162 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
163 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reiss9a961e72010-10-06 17:10:23 +0000164 zlib_trans->write(buf, buf_len);
David Reisse94fa332010-10-06 17:10:26 +0000165 zlib_trans->finish();
David Reiss9a961e72010-10-06 17:10:23 +0000166 string tmp_buf;
167 membuf->appendBufferToString(tmp_buf);
David Reissa0e11592010-10-06 17:10:27 +0000168 zlib_trans.reset(new TZlibTransport(membuf,
David Reiss9a961e72010-10-06 17:10:23 +0000169 TZlibTransport::DEFAULT_URBUF_SIZE,
Jake Farrell5d02b802014-01-07 21:42:01 -0500170 static_cast<uint32_t>(tmp_buf.length()-1)));
David Reissfaebedd2007-09-17 23:20:38 +0000171
David Reiss9a961e72010-10-06 17:10:23 +0000172 boost::shared_array<uint8_t> mirror(new uint8_t[buf_len]);
David Reiss0a2d81e2010-10-06 17:10:40 +0000173 uint32_t got = zlib_trans->readAll(mirror.get(), buf_len);
David Reiss9a961e72010-10-06 17:10:23 +0000174 BOOST_REQUIRE_EQUAL(got, buf_len);
175 BOOST_CHECK_EQUAL(memcmp(mirror.get(), buf, buf_len), 0);
176 zlib_trans->verifyChecksum();
177}
David Reissfaebedd2007-09-17 23:20:38 +0000178
David Reiss9a961e72010-10-06 17:10:23 +0000179void test_incomplete_checksum(const uint8_t* buf, uint32_t buf_len) {
180 // Make sure we still get that "not complete" error if
181 // it really isn't complete.
Roger Meier611f90c2011-12-11 22:08:51 +0000182 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
183 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reiss9a961e72010-10-06 17:10:23 +0000184 zlib_trans->write(buf, buf_len);
David Reisse94fa332010-10-06 17:10:26 +0000185 zlib_trans->finish();
David Reiss9a961e72010-10-06 17:10:23 +0000186 string tmp_buf;
187 membuf->appendBufferToString(tmp_buf);
188 tmp_buf.erase(tmp_buf.length() - 1);
189 membuf->resetBuffer(const_cast<uint8_t*>(
190 reinterpret_cast<const uint8_t*>(tmp_buf.data())),
Jake Farrell5d02b802014-01-07 21:42:01 -0500191 static_cast<uint32_t>(tmp_buf.length()));
David Reiss9a961e72010-10-06 17:10:23 +0000192
193 boost::shared_array<uint8_t> mirror(new uint8_t[buf_len]);
David Reiss0a2d81e2010-10-06 17:10:40 +0000194 uint32_t got = zlib_trans->readAll(mirror.get(), buf_len);
David Reiss9a961e72010-10-06 17:10:23 +0000195 BOOST_REQUIRE_EQUAL(got, buf_len);
196 BOOST_CHECK_EQUAL(memcmp(mirror.get(), buf, buf_len), 0);
197 try {
198 zlib_trans->verifyChecksum();
199 BOOST_ERROR("verifyChecksum() did not report an error");
200 } catch (TTransportException& ex) {
201 BOOST_CHECK_EQUAL(ex.getType(), TTransportException::CORRUPTED_DATA);
202 }
203}
204
205void test_read_write_mix(const uint8_t* buf, uint32_t buf_len,
Roger Meier611f90c2011-12-11 22:08:51 +0000206 const boost::shared_ptr<SizeGenerator>& write_gen,
207 const boost::shared_ptr<SizeGenerator>& read_gen) {
David Reiss9a961e72010-10-06 17:10:23 +0000208 // Try it with a mix of read/write sizes.
Roger Meier611f90c2011-12-11 22:08:51 +0000209 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
210 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reiss9a961e72010-10-06 17:10:23 +0000211 unsigned int tot;
212
David Reiss9a961e72010-10-06 17:10:23 +0000213 tot = 0;
214 while (tot < buf_len) {
David Reissf2abcf92010-10-06 17:10:24 +0000215 uint32_t write_len = write_gen->getSize();
David Reiss9a961e72010-10-06 17:10:23 +0000216 if (tot + write_len > buf_len) {
217 write_len = buf_len - tot;
David Reissfaebedd2007-09-17 23:20:38 +0000218 }
David Reiss9a961e72010-10-06 17:10:23 +0000219 zlib_trans->write(buf + tot, write_len);
220 tot += write_len;
David Reiss9a961e72010-10-06 17:10:23 +0000221 }
David Reissfaebedd2007-09-17 23:20:38 +0000222
David Reisse94fa332010-10-06 17:10:26 +0000223 zlib_trans->finish();
David Reiss9a961e72010-10-06 17:10:23 +0000224
David Reiss9a961e72010-10-06 17:10:23 +0000225 tot = 0;
226 boost::shared_array<uint8_t> mirror(new uint8_t[buf_len]);
227 while (tot < buf_len) {
David Reissf2abcf92010-10-06 17:10:24 +0000228 uint32_t read_len = read_gen->getSize();
David Reiss9a961e72010-10-06 17:10:23 +0000229 uint32_t expected_read_len = read_len;
230 if (tot + read_len > buf_len) {
231 expected_read_len = buf_len - tot;
David Reissfaebedd2007-09-17 23:20:38 +0000232 }
David Reiss9a961e72010-10-06 17:10:23 +0000233 uint32_t got = zlib_trans->read(mirror.get() + tot, read_len);
David Reiss0a2d81e2010-10-06 17:10:40 +0000234 BOOST_REQUIRE_LE(got, expected_read_len);
Christian Lavoie01c5ceb2010-11-04 20:35:15 +0000235 BOOST_REQUIRE_NE(got, (uint32_t) 0);
David Reiss9a961e72010-10-06 17:10:23 +0000236 tot += got;
David Reiss9a961e72010-10-06 17:10:23 +0000237 }
David Reissfaebedd2007-09-17 23:20:38 +0000238
David Reiss9a961e72010-10-06 17:10:23 +0000239 BOOST_CHECK_EQUAL(memcmp(mirror.get(), buf, buf_len), 0);
240 zlib_trans->verifyChecksum();
241}
David Reissfaebedd2007-09-17 23:20:38 +0000242
David Reiss9a961e72010-10-06 17:10:23 +0000243void test_invalid_checksum(const uint8_t* buf, uint32_t buf_len) {
244 // Verify checksum checking.
Roger Meier611f90c2011-12-11 22:08:51 +0000245 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
246 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reiss9a961e72010-10-06 17:10:23 +0000247 zlib_trans->write(buf, buf_len);
David Reisse94fa332010-10-06 17:10:26 +0000248 zlib_trans->finish();
David Reiss9a961e72010-10-06 17:10:23 +0000249 string tmp_buf;
250 membuf->appendBufferToString(tmp_buf);
251 // Modify a byte at the end of the buffer (part of the checksum).
252 // On rare occasions, modifying a byte in the middle of the buffer
253 // isn't caught by the checksum.
254 //
255 // (This happens especially often for the uniform buffer. The
256 // re-inflated data is correct, however. I suspect in this case that
257 // we're more likely to modify bytes that are part of zlib metadata
258 // instead of the actual compressed data.)
259 //
260 // I've also seen some failure scenarios where a checksum failure isn't
261 // reported, but zlib keeps trying to decode past the end of the data.
262 // (When this occurs, verifyChecksum() throws an exception indicating
263 // that the end of the data hasn't been reached.) I haven't seen this
264 // error when only modifying checksum bytes.
Jake Farrell5d02b802014-01-07 21:42:01 -0500265 int index = static_cast<int>(tmp_buf.size() - 1);
David Reiss9a961e72010-10-06 17:10:23 +0000266 tmp_buf[index]++;
267 membuf->resetBuffer(const_cast<uint8_t*>(
268 reinterpret_cast<const uint8_t*>(tmp_buf.data())),
Jake Farrell5d02b802014-01-07 21:42:01 -0500269 static_cast<uint32_t>(tmp_buf.length()));
David Reissfaebedd2007-09-17 23:20:38 +0000270
David Reiss9a961e72010-10-06 17:10:23 +0000271 boost::shared_array<uint8_t> mirror(new uint8_t[buf_len]);
272 try {
David Reiss0a2d81e2010-10-06 17:10:40 +0000273 zlib_trans->readAll(mirror.get(), buf_len);
David Reiss9a961e72010-10-06 17:10:23 +0000274 zlib_trans->verifyChecksum();
275 BOOST_ERROR("verifyChecksum() did not report an error");
276 } catch (TZlibTransportException& ex) {
277 BOOST_CHECK_EQUAL(ex.getType(), TTransportException::INTERNAL_ERROR);
278 }
279}
David Reissfaebedd2007-09-17 23:20:38 +0000280
David Reisse94fa332010-10-06 17:10:26 +0000281void test_write_after_flush(const uint8_t* buf, uint32_t buf_len) {
282 // write some data
Roger Meier611f90c2011-12-11 22:08:51 +0000283 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
284 boost::shared_ptr<TZlibTransport> zlib_trans(new TZlibTransport(membuf));
David Reisse94fa332010-10-06 17:10:26 +0000285 zlib_trans->write(buf, buf_len);
286
287 // call finish()
288 zlib_trans->finish();
289
290 // make sure write() throws an error
291 try {
292 uint8_t write_buf[] = "a";
293 zlib_trans->write(write_buf, 1);
294 BOOST_ERROR("write() after finish() did not raise an exception");
295 } catch (TTransportException& ex) {
296 BOOST_CHECK_EQUAL(ex.getType(), TTransportException::BAD_ARGS);
297 }
298
299 // make sure flush() throws an error
300 try {
301 zlib_trans->flush();
302 BOOST_ERROR("flush() after finish() did not raise an exception");
303 } catch (TTransportException& ex) {
304 BOOST_CHECK_EQUAL(ex.getType(), TTransportException::BAD_ARGS);
305 }
306
307 // make sure finish() throws an error
308 try {
309 zlib_trans->finish();
310 BOOST_ERROR("finish() after finish() did not raise an exception");
311 } catch (TTransportException& ex) {
312 BOOST_CHECK_EQUAL(ex.getType(), TTransportException::BAD_ARGS);
313 }
314}
315
316void test_no_write() {
317 // Verify that no data is written to the underlying transport if we
318 // never write data to the TZlibTransport.
Roger Meier611f90c2011-12-11 22:08:51 +0000319 boost::shared_ptr<TMemoryBuffer> membuf(new TMemoryBuffer());
David Reisse94fa332010-10-06 17:10:26 +0000320 {
321 // Create a TZlibTransport object, and immediately destroy it
322 // when it goes out of scope.
David Reissa0e11592010-10-06 17:10:27 +0000323 TZlibTransport w_zlib_trans(membuf);
David Reisse94fa332010-10-06 17:10:26 +0000324 }
325
Christian Lavoie01c5ceb2010-11-04 20:35:15 +0000326 BOOST_CHECK_EQUAL(membuf->available_read(), (uint32_t) 0);
David Reisse94fa332010-10-06 17:10:26 +0000327}
328
David Reissf2abcf92010-10-06 17:10:24 +0000329/*
330 * Initialization
331 */
332
David Reiss9a961e72010-10-06 17:10:23 +0000333#define ADD_TEST_CASE(suite, name, function, ...) \
334 do { \
335 ::std::ostringstream name_ss; \
336 name_ss << name << "-" << BOOST_STRINGIZE(function); \
337 ::boost::unit_test::test_case* tc = ::boost::unit_test::make_test_case( \
Jake Farrell5d02b802014-01-07 21:42:01 -0500338 ::apache::thrift::stdcxx::bind(function, ## __VA_ARGS__), \
David Reiss9a961e72010-10-06 17:10:23 +0000339 name_ss.str()); \
340 (suite)->add(tc); \
341 } while (0)
David Reissfaebedd2007-09-17 23:20:38 +0000342
Jake Farrell5d02b802014-01-07 21:42:01 -0500343void add_tests(boost::unit_test::test_suite* suite,
David Reiss9a961e72010-10-06 17:10:23 +0000344 const uint8_t* buf,
345 uint32_t buf_len,
346 const char* name) {
347 ADD_TEST_CASE(suite, name, test_write_then_read, buf, buf_len);
348 ADD_TEST_CASE(suite, name, test_separate_checksum, buf, buf_len);
349 ADD_TEST_CASE(suite, name, test_incomplete_checksum, buf, buf_len);
David Reiss9a961e72010-10-06 17:10:23 +0000350 ADD_TEST_CASE(suite, name, test_invalid_checksum, buf, buf_len);
David Reisse94fa332010-10-06 17:10:26 +0000351 ADD_TEST_CASE(suite, name, test_write_after_flush, buf, buf_len);
David Reissf2abcf92010-10-06 17:10:24 +0000352
Roger Meier611f90c2011-12-11 22:08:51 +0000353 boost::shared_ptr<SizeGenerator> size_32k(new ConstantSizeGenerator(1<<15));
354 boost::shared_ptr<SizeGenerator> size_lognormal(new LogNormalSizeGenerator(20, 30));
David Reissf2abcf92010-10-06 17:10:24 +0000355 ADD_TEST_CASE(suite, name << "-constant",
356 test_read_write_mix, buf, buf_len,
357 size_32k, size_32k);
358 ADD_TEST_CASE(suite, name << "-lognormal-write",
359 test_read_write_mix, buf, buf_len,
360 size_lognormal, size_32k);
361 ADD_TEST_CASE(suite, name << "-lognormal-read",
362 test_read_write_mix, buf, buf_len,
363 size_32k, size_lognormal);
364 ADD_TEST_CASE(suite, name << "-lognormal-both",
365 test_read_write_mix, buf, buf_len,
366 size_lognormal, size_lognormal);
367
368 // Test with a random size distribution,
369 // but use the exact same distribution for reading as for writing.
370 //
371 // Because the SizeGenerator makes a copy of the random number generator,
372 // both SizeGenerators should return the exact same set of values, since they
373 // both start with random number generators in the same state.
Roger Meier611f90c2011-12-11 22:08:51 +0000374 boost::shared_ptr<SizeGenerator> write_size_gen(new LogNormalSizeGenerator(20, 30));
375 boost::shared_ptr<SizeGenerator> read_size_gen(new LogNormalSizeGenerator(20, 30));
David Reissf2abcf92010-10-06 17:10:24 +0000376 ADD_TEST_CASE(suite, name << "-lognormal-same-distribution",
377 test_read_write_mix, buf, buf_len,
378 write_size_gen, read_size_gen);
David Reiss9a961e72010-10-06 17:10:23 +0000379}
380
381void print_usage(FILE* f, const char* argv0) {
382 fprintf(f, "Usage: %s [boost_options] [options]\n", argv0);
383 fprintf(f, "Options:\n");
384 fprintf(f, " --seed=<N>, -s <N>\n");
385 fprintf(f, " --help\n");
386}
387
Jake Farrell5d02b802014-01-07 21:42:01 -0500388boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
Konrad Grochowskib3f5ffc2014-11-06 19:32:59 +0100389 THRIFT_UNUSED_VARIABLE(argc);
390 THRIFT_UNUSED_VARIABLE(argv);
Jake Farrell5d02b802014-01-07 21:42:01 -0500391 uint32_t seed = static_cast<uint32_t>(time(NULL));
David Reiss9a961e72010-10-06 17:10:23 +0000392 printf("seed: %" PRIu32 "\n", seed);
393 rng.seed(seed);
David Reiss9a961e72010-10-06 17:10:23 +0000394
Jake Farrell5d02b802014-01-07 21:42:01 -0500395 boost::unit_test::test_suite* suite =
David Reiss109693c2010-10-06 17:10:42 +0000396 &boost::unit_test::framework::master_test_suite();
397 suite->p_name.value = "ZlibTest";
David Reiss9a961e72010-10-06 17:10:23 +0000398
399 uint32_t buf_len = 1024*32;
400 add_tests(suite, gen_uniform_buffer(buf_len, 'a'), buf_len, "uniform");
401 add_tests(suite, gen_compressible_buffer(buf_len), buf_len, "compressible");
402 add_tests(suite, gen_random_buffer(buf_len), buf_len, "random");
403
David Reisse94fa332010-10-06 17:10:26 +0000404 suite->add(BOOST_TEST_CASE(test_no_write));
405
David Reiss109693c2010-10-06 17:10:42 +0000406 return NULL;
David Reissfaebedd2007-09-17 23:20:38 +0000407}