def test_compute_product_small_list_mpz(compute_product, n): random.seed(n) xs = [mpz(random.randint(-42, 42)) for i in range(n)] ys = copy.copy(xs) result = mpz(1) for y in ys: result *= y assert compute_product(xs) == result, "Simple none-zero product with mpz"
def test_compute_product_small_list(compute_product, n): random.seed(n) xs = [random.randint(-42, 42) for i in range(n)] ys = copy.copy(xs) result = 1 for y in ys: result *= y assert compute_product(xs) == result, "Simple non-zero list product failed"
def test_compute_product_single(compute_product, n): assert compute_product([n]) == n, "Single element must be unchanged"
def test_compute_product_empty(compute_product): assert compute_product([]) == 0, "Empty list must have product 0"