From 485f6afe4282a8172adec7d5e65df1a6c3b61a71 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Sun, 24 Mar 2024 11:10:49 +0100 Subject: [PATCH] moved TYPE checks to tests --- prime_field.hh | 4 ---- tests/pf_test.cc | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/prime_field.hh b/prime_field.hh index a70816b..c2506f0 100644 --- a/prime_field.hh +++ b/prime_field.hh @@ -6,15 +6,11 @@ Copyright 2024 Ahmet Inan #pragma once -#include - namespace CODE { template struct PrimeField { - static_assert(std::is_unsigned::value, "TYPE must be unsigned"); - static_assert(std::numeric_limits::max() / (PRIME-1) >= (PRIME-1), "Type not wide enough"); static constexpr TYPE P = PRIME; TYPE v; PrimeField() = default; diff --git a/tests/pf_test.cc b/tests/pf_test.cc index ee38696..0ae8e02 100644 --- a/tests/pf_test.cc +++ b/tests/pf_test.cc @@ -4,14 +4,18 @@ Test for the prime field arithmetic Copyright 2024 Ahmet Inan */ +#include #include #include #include +#include #include "prime_field.hh" template void exhaustive_test() { + assert(std::is_unsigned::value); + assert(std::numeric_limits::max() / (PRIME-1) >= (PRIME-1)); typedef CODE::PrimeField PF; for (TYPE a = 0; a < PRIME; ++a) for (TYPE b = 0; b < PRIME; ++b)