From 5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Wed, 21 Jan 2026 22:40:55 +0100 Subject: Add Redis source code for testing --- .../redis-unstable/deps/jemalloc/test/unit/div.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/redis-unstable/deps/jemalloc/test/unit/div.c (limited to 'examples/redis-unstable/deps/jemalloc/test/unit/div.c') diff --git a/examples/redis-unstable/deps/jemalloc/test/unit/div.c b/examples/redis-unstable/deps/jemalloc/test/unit/div.c new file mode 100644 index 0000000..29aea66 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/unit/div.c @@ -0,0 +1,29 @@ +#include "test/jemalloc_test.h" + +#include "jemalloc/internal/div.h" + +TEST_BEGIN(test_div_exhaustive) { + for (size_t divisor = 2; divisor < 1000 * 1000; ++divisor) { + div_info_t div_info; + div_init(&div_info, divisor); + size_t max = 1000 * divisor; + if (max < 1000 * 1000) { + max = 1000 * 1000; + } + for (size_t dividend = 0; dividend < 1000 * divisor; + dividend += divisor) { + size_t quotient = div_compute( + &div_info, dividend); + expect_zu_eq(dividend, quotient * divisor, + "With divisor = %zu, dividend = %zu, " + "got quotient %zu", divisor, dividend, quotient); + } + } +} +TEST_END + +int +main(void) { + return test_no_reentrancy( + test_div_exhaustive); +} -- cgit v1.2.3