MCPcopy Create free account
hub / github.com/apache/thrift / add_tests

Function add_tests

lib/cpp/test/ZlibTest.cpp:367–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365#endif
366
367void add_tests(boost::unit_test::test_suite* suite,
368 const boost::shared_array<uint8_t>& buf,
369 uint32_t buf_len,
370 const char* name) {
371 ADD_TEST_CASE(suite, name, test_write_then_read, buf, buf_len);
372 ADD_TEST_CASE(suite, name, test_separate_checksum, buf, buf_len);
373 ADD_TEST_CASE(suite, name, test_incomplete_checksum, buf, buf_len);
374 ADD_TEST_CASE(suite, name, test_invalid_checksum, buf, buf_len);
375 ADD_TEST_CASE(suite, name, test_write_after_flush, buf, buf_len);
376
377 shared_ptr<SizeGenerator> size_32k(new ConstantSizeGenerator(1 << 15));
378 shared_ptr<SizeGenerator> size_lognormal(new LogNormalSizeGenerator(20, 30));
379 ADD_TEST_CASE(suite, name << "-constant", test_read_write_mix, buf, buf_len, size_32k, size_32k);
380 ADD_TEST_CASE(suite,
381 name << "-lognormal-write",
382 test_read_write_mix,
383 buf,
384 buf_len,
385 size_lognormal,
386 size_32k);
387 ADD_TEST_CASE(suite,
388 name << "-lognormal-read",
389 test_read_write_mix,
390 buf,
391 buf_len,
392 size_32k,
393 size_lognormal);
394 ADD_TEST_CASE(suite,
395 name << "-lognormal-both",
396 test_read_write_mix,
397 buf,
398 buf_len,
399 size_lognormal,
400 size_lognormal);
401
402 // Test with a random size distribution,
403 // but use the exact same distribution for reading as for writing.
404 //
405 // Because the SizeGenerator makes a copy of the random number generator,
406 // both SizeGenerators should return the exact same set of values, since they
407 // both start with random number generators in the same state.
408 shared_ptr<SizeGenerator> write_size_gen(new LogNormalSizeGenerator(20, 30));
409 shared_ptr<SizeGenerator> read_size_gen(new LogNormalSizeGenerator(20, 30));
410 ADD_TEST_CASE(suite,
411 name << "-lognormal-same-distribution",
412 test_read_write_mix,
413 buf,
414 buf_len,
415 write_size_gen,
416 read_size_gen);
417}
418
419void print_usage(FILE* f, const char* argv0) {
420 fprintf(f, "Usage: %s [boost_options] [options]\n", argv0);

Callers 1

init_unit_test_suiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected