diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2022-12-06 11:28:58 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-12-19 22:32:35 +0000 |
commit | baba440ffaaf849e14e31862649767227e8c6432 (patch) | |
tree | 251f811ac03734b045797223486eae7955e01360 /lib/compression | |
parent | b99e0e9301d14574ed24181ce300ea61558d4d02 (diff) | |
download | samba-baba440ffaaf849e14e31862649767227e8c6432.tar.gz |
compression tests: avoid div by zero in failure (CID 1517297)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/compression')
-rw-r--r-- | lib/compression/tests/test_lzx_huffman.c | 1 | ||||
-rw-r--r-- | lib/compression/tests/test_lzxpress_plain.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/compression/tests/test_lzx_huffman.c b/lib/compression/tests/test_lzx_huffman.c index 647a01fa3c0..b7f22b9072b 100644 --- a/lib/compression/tests/test_lzx_huffman.c +++ b/lib/compression/tests/test_lzx_huffman.c @@ -694,6 +694,7 @@ static void test_lzxpress_huffman_round_trip(void **state) print_message("total reference size: %zd \n", reference_total); print_message("diff: %7zd \n", reference_total - compressed_total); + assert_true(reference_total != 0); print_message("ratio: \033[1;3%dm%.2f\033[0m \n", 2 + (compressed_total >= reference_total), ((double)compressed_total) / reference_total); diff --git a/lib/compression/tests/test_lzxpress_plain.c b/lib/compression/tests/test_lzxpress_plain.c index 1264f48530b..b1a4bee6e92 100644 --- a/lib/compression/tests/test_lzxpress_plain.c +++ b/lib/compression/tests/test_lzxpress_plain.c @@ -475,6 +475,7 @@ static void test_lzxpress_plain_round_trip_files(void **state) print_message("total reference size: %zd \n", reference_total); print_message("diff: %7zd \n", reference_total - compressed_total); + assert_true(reference_total != 0); print_message("ratio: \033[1;3%dm%.2f\033[0m \n", 2 + (compressed_total >= reference_total), ((double)compressed_total) / reference_total); |