TEST pseudorandom_data_should_match(uint32_t size, uint32_t seed, cfg_info *cfg) { uint8_t input[size]; if (cfg->log_lvl > 0) { printf("\n-- size %u, seed %u, input buf %u\n", size, seed, cfg->decoder_input_buffer_size); } fill_with_pseudorandom_letters(input, size, seed); return compress_and_expand_and_check(input, size, cfg); }
TEST sixty_four_k() { /* Regression: An input buffer of 64k should not cause an * overflow that leads to an infinite loop. */ uint32_t size = 64 * 1024; uint32_t seed = 1; uint8_t input[size]; fill_with_pseudorandom_letters(input, size, seed); cfg_info cfg; cfg.log_lvl = 0; cfg.window_sz2 = 8; cfg.lookahead_sz2 = 3; cfg.decoder_input_buffer_size = 64; return compress_and_expand_and_check(input, size, &cfg); }
TEST regression_backreference_counters_should_not_roll_over() { /* Searching was scanning the entire context buffer, not just * the maximum range addressable by the backref index.*/ uint32_t size = 337; uint32_t seed = 3; uint8_t input[size]; fill_with_pseudorandom_letters(input, size, seed); cfg_info cfg; cfg.log_lvl = 0; cfg.window_sz2 = 8; cfg.lookahead_sz2 = 3; cfg.decoder_input_buffer_size = 64; // 1 return compress_and_expand_and_check(input, size, &cfg); }
TEST regression_index_fail() { /* Failured when indexed, cause unknown. * * This has something to do with bad data at the very last * byte being indexed, due to spillover. */ uint32_t size = 507; uint32_t seed = 3; uint8_t input[size]; fill_with_pseudorandom_letters(input, size, seed); cfg_info cfg; cfg.log_lvl = 0; cfg.window_sz2 = 8; cfg.lookahead_sz2 = 3; cfg.decoder_input_buffer_size = 64; return compress_and_expand_and_check(input, size, &cfg); }
TEST pseudorandom_data_should_match(uint32_t size, uint32_t seed) { uint8_t input[size]; fill_with_pseudorandom_letters(input, size, seed); return compress_and_expand_and_check(input, size, 0); }