<commit_before>#include "test-squash.h"

#define INPUT_BUF_SIZE ((size_t) (1024 * 1024 * 6))

static MunitResult
squash_test_random_compress(MUNIT_UNUSED const MunitParameter params[], void* user_data) {
  SquashCodec* codec = (SquashCodec*) user_data;
  size_t uncompressed_length;
  uint8_t* uncompressed_data = munit_newa (uint8_t, INPUT_BUF_SIZE);
  const size_t max_compressed_size = squash_codec_get_max_compressed_size (codec, INPUT_BUF_SIZE);
  size_t compressed_length;
  uint8_t* compressed_data = munit_newa (uint8_t, max_compressed_size);
  size_t decompressed_length;
  uint8_t* decompressed_data = munit_newa (uint8_t, INPUT_BUF_SIZE);

  munit_rand_memory(INPUT_BUF_SIZE, uncompressed_data);

  for (uncompressed_length = 1 ;
       uncompressed_length < INPUT_BUF_SIZE ;
       uncompressed_length += munit_rand_int_range (256, 1024) * (2 + (uncompressed_length / 512))) {
    compressed_length = squash_codec_get_max_compressed_size (codec, uncompressed_length);<commit_msg>tests/random-data: only use up to 3 MiB of random data<commit_after>#include "test-squash.h"

#define INPUT_BUF_SIZE ((size_t) (1024 * 1024 * 3))

static MunitResult
squash_test_random_compress(MUNIT_UNUSED const MunitParameter params[], void* user_data) {
  SquashCodec* codec = (SquashCodec*) user_data;
  size_t uncompressed_length;
  uint8_t* uncompressed_data = munit_newa (uint8_t, INPUT_BUF_SIZE);
  const size_t max_compressed_size = squash_codec_get_max_compressed_size (codec, INPUT_BUF_SIZE);
  size_t compressed_length;
  uint8_t* compressed_data = munit_newa (uint8_t, max_compressed_size);
  size_t decompressed_length;
  uint8_t* decompressed_data = munit_newa (uint8_t, INPUT_BUF_SIZE);

  munit_rand_memory(INPUT_BUF_SIZE, uncompressed_data);

  for (uncompressed_length = 1 ;
       uncompressed_length < INPUT_BUF_SIZE ;
       uncompressed_length += munit_rand_int_range (256, 1024) * (2 + (uncompressed_length / 512))) {
    compressed_length = squash_codec_get_max_compressed_size (codec, uncompressed_length);
{'fraction_non_alphanumeric': 0.08452792881858626, 'fraction_numerical': 0.02718734552644587, 'mean_word_length': 6.609022556390977, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5069167', 'n_tokens_mistral': 787, 'n_tokens_neox': 727, 'n_words': 138}