Polly 20.0.0git
|
#include <stdbool.h>
#include <stdio.h>
Go to the source code of this file.
Classes | |
struct | testspec_t |
Typedefs | |
typedef bool(* | test_f) (testspec_t *, FILE *) |
Functions | |
void | init_testing (void) |
void | reset_registers (void) |
bool | test_init (testspec_t *t, FILE *ofp) |
bool | test_set (testspec_t *t, FILE *ofp) |
bool | test_neg (testspec_t *t, FILE *ofp) |
bool | test_abs (testspec_t *t, FILE *ofp) |
bool | test_add (testspec_t *t, FILE *ofp) |
bool | test_sub (testspec_t *t, FILE *ofp) |
bool | test_mul (testspec_t *t, FILE *ofp) |
bool | test_mulp2 (testspec_t *t, FILE *ofp) |
bool | test_mulv (testspec_t *t, FILE *ofp) |
bool | test_sqr (testspec_t *t, FILE *ofp) |
bool | test_div (testspec_t *t, FILE *ofp) |
bool | test_divp2 (testspec_t *t, FILE *ofp) |
bool | test_divv (testspec_t *t, FILE *ofp) |
bool | test_expt (testspec_t *t, FILE *ofp) |
bool | test_exptv (testspec_t *t, FILE *ofp) |
bool | test_exptf (testspec_t *t, FILE *ofp) |
bool | test_mod (testspec_t *t, FILE *ofp) |
bool | test_gcd (testspec_t *t, FILE *ofp) |
bool | test_egcd (testspec_t *t, FILE *ofp) |
bool | test_lcm (testspec_t *t, FILE *ofp) |
bool | test_sqrt (testspec_t *t, FILE *ofp) |
bool | test_root (testspec_t *t, FILE *ofp) |
bool | test_invmod (testspec_t *t, FILE *ofp) |
bool | test_exptmod (testspec_t *t, FILE *ofp) |
bool | test_exptmod_ev (testspec_t *t, FILE *ofp) |
bool | test_exptmod_bv (testspec_t *t, FILE *ofp) |
bool | test_comp (testspec_t *t, FILE *ofp) |
bool | test_ucomp (testspec_t *t, FILE *ofp) |
bool | test_zcomp (testspec_t *t, FILE *ofp) |
bool | test_vcomp (testspec_t *t, FILE *ofp) |
bool | test_uvcomp (testspec_t *t, FILE *ofp) |
bool | test_tostr (testspec_t *t, FILE *ofp) |
bool | test_tobin (testspec_t *t, FILE *ofp) |
bool | test_to_int (testspec_t *t, FILE *ofp) |
bool | test_to_uint (testspec_t *t, FILE *ofp) |
bool | test_read_binary (testspec_t *t, FILE *ofp) |
bool | test_to_uns (testspec_t *t, FILE *ofp) |
bool | test_read_uns (testspec_t *t, FILE *ofp) |
bool | test_meta (testspec_t *t, FILE *ofp) |
bool | test_qneg (testspec_t *t, FILE *ofp) |
bool | test_qrecip (testspec_t *t, FILE *ofp) |
bool | test_qabs (testspec_t *t, FILE *ofp) |
bool | test_qadd (testspec_t *t, FILE *ofp) |
bool | test_qsub (testspec_t *t, FILE *ofp) |
bool | test_qmul (testspec_t *t, FILE *ofp) |
bool | test_qdiv (testspec_t *t, FILE *ofp) |
bool | test_qaddz (testspec_t *t, FILE *ofp) |
bool | test_qsubz (testspec_t *t, FILE *ofp) |
bool | test_qmulz (testspec_t *t, FILE *ofp) |
bool | test_qdivz (testspec_t *t, FILE *ofp) |
bool | test_qexpt (testspec_t *t, FILE *ofp) |
bool | test_qtostr (testspec_t *t, FILE *ofp) |
bool | test_qtodec (testspec_t *t, FILE *ofp) |
bool | test_qrdec (testspec_t *t, FILE *ofp) |
bool | test_is_prime (testspec_t *t, FILE *ofp) |
typedef bool(* test_f) (testspec_t *, FILE *) |
Definition at line 43 of file imdrover.h.
void init_testing | ( | void | ) |
Definition at line 411 of file imdrover.c.
References assert, done_testing(), g_output, g_qreg, g_zreg, imath_errmsg, mp_int_init, MP_OK, mp_rat_init, and NUM_REGS.
Referenced by main().
void reset_registers | ( | void | ) |
Definition at line 427 of file imdrover.c.
References g_qreg, g_zreg, mp_int_zero, mp_rat_zero, and NUM_REGS.
bool test_abs | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 497 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_abs, mp_int_compare, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_add | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 512 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_add, mp_int_add_value, mp_int_compare, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_comp | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 897 of file imdrover.c.
References ACHECK, FAIL, g_output, mp_int_compare, OTHER_ERROR, parse_int_values(), res, and t.
bool test_div | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 615 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_div, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), str, and t.
bool test_divp2 | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 636 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_div_pow2, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), str, and t.
bool test_divv | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 659 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_div_value, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), str, and t.
bool test_egcd | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 757 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, g_zreg, mp_int_add, mp_int_compare, mp_int_egcd, mp_int_mul, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), str, t, t1, and t2.
bool test_expt | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 682 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_expt, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_exptf | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 715 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_expt_full, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_exptmod | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 851 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_exptmod, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_exptmod_bv | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 881 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_exptmod_bvalue, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_exptmod_ev | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 865 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_exptmod_evalue, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_exptv | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 698 of file imdrover.c.
References a(), ACHECK, b(), CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_expt_value, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_gcd | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 743 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_gcd, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_init | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 434 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_init_uvalue, mp_int_init_value, mp_int_to_int, mp_int_to_string, mp_int_to_uint, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_invmod | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 837 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_invmod, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_is_prime | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1453 of file imdrover.c.
References ACHECK, ECHECK, mp_int_is_prime(), parse_int_values(), and t.
bool test_lcm | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 793 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_lcm, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_meta | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1121 of file imdrover.c.
References FAIL, g_output, MP_BADARG, mp_int_to_string, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_mod | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 729 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_mod, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_mul | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 555 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_mul, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_mulp2 | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 569 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_mul_pow2, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_mulv | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 585 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_mul_value, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_neg | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 482 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_neg, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_qabs | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1194 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_abs, mp_rat_compare, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qadd | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1208 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_add, mp_rat_compare, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qaddz | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1264 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_BADARG, MP_NUMER_P(), MP_OK, mp_rat_add_int, mp_rat_compare, mp_rat_is_integer, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qdiv | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1250 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_compare, mp_rat_div, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qdivz | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1330 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_BADARG, MP_NUMER_P(), MP_OK, mp_rat_compare, mp_rat_div_int, mp_rat_is_integer, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qexpt | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1352 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, MP_BADARG, mp_int_to_int, MP_NUMER_P(), MP_OK, mp_rat_compare, mp_rat_expt, mp_rat_is_integer, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), power(), and t.
bool test_qmul | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1236 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_compare, mp_rat_mul, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qmulz | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1308 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_BADARG, MP_NUMER_P(), MP_OK, mp_rat_compare, mp_rat_is_integer, mp_rat_mul_int, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qneg | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1166 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_compare, mp_rat_neg, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qrdec | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1436 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, g_qreg, MP_OK, mp_rat_compare, mp_rat_read_decimal, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), read_long(), t, and trim_line().
bool test_qrecip | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1180 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_compare, mp_rat_recip, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qsub | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1222 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_OK, mp_rat_compare, mp_rat_sub, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qsubz | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1286 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, MP_BADARG, MP_NUMER_P(), MP_OK, mp_rat_compare, mp_rat_is_integer, mp_rat_sub_int, mp_rat_to_string, OTHER_ERROR, OUTPUT_LIMIT, parse_rat_values(), and t.
bool test_qtodec | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1400 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, m, MP_OK, MP_RANGE, mp_rat_decimal_len, mp_rat_to_decimal, OTHER_ERROR, parse_rat_values(), parse_result_code(), read_long(), res, t, and trim_line().
bool test_qtostr | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1376 of file imdrover.c.
References ACHECK, CHECK, FAIL, g_output, MP_MAX_RADIX, MP_RANGE, mp_rat_string_len, mp_rat_to_string, OTHER_ERROR, parse_rat_values(), read_long(), t, and trim_line().
bool test_read_binary | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1051 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_bin1, g_output, g_zreg, MP_BADARG, mp_int_compare, mp_int_read_binary, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_binary(), parse_int_values(), t, and trim_line().
bool test_read_uns | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1101 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_bin1, g_output, g_zreg, MP_BADARG, mp_int_compare, mp_int_read_unsigned, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_binary(), parse_int_values(), t, and trim_line().
bool test_root | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 821 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_root, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_set | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 458 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_set_uvalue, mp_int_set_value, mp_int_to_int, mp_int_to_string, mp_int_to_uint, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_sqr | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 601 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_sqr, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_sqrt | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 807 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_sqrt(), mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_sub | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 534 of file imdrover.c.
References ACHECK, CHECK, ECHECK, FAIL, g_output, mp_int_compare, mp_int_sub, mp_int_sub_value, mp_int_to_int, mp_int_to_string, MP_OK, OTHER_ERROR, OUTPUT_LIMIT, parse_int_values(), and t.
bool test_to_int | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1021 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare_value, mp_int_to_int, MP_OK, OTHER_ERROR, parse_int_values(), and t.
bool test_to_uint | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1036 of file imdrover.c.
References ACHECK, ECHECK, FAIL, g_output, mp_int_compare_uvalue, mp_int_to_uint, MP_OK, OTHER_ERROR, parse_int_values(), and t.
bool test_to_uns | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 1071 of file imdrover.c.
References ACHECK, CHECK, FAIL, g_bin1, g_bin2, g_output, MP_BADARG, mp_int_to_unsigned, mp_int_unsigned_len, OTHER_ERROR, parse_binary(), parse_int_values(), pos(), t, and trim_line().
bool test_tobin | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 991 of file imdrover.c.
References ACHECK, CHECK, FAIL, g_bin1, g_bin2, g_output, MP_BADARG, mp_int_binary_len, mp_int_to_binary, OTHER_ERROR, parse_binary(), parse_int_values(), pos(), t, and trim_line().
bool test_tostr | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 971 of file imdrover.c.
References ACHECK, CHECK, FAIL, g_output, mp_int_string_len, mp_int_to_int, mp_int_to_string, MP_MAX_RADIX, MP_OK, MP_RANGE, OTHER_ERROR, parse_int_values(), t, and trim_line().
bool test_ucomp | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 911 of file imdrover.c.
References ACHECK, FAIL, g_output, mp_int_compare_unsigned, OTHER_ERROR, parse_int_values(), res, and t.
bool test_uvcomp | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 955 of file imdrover.c.
References ACHECK, FAIL, g_output, mp_int_compare_uvalue, OTHER_ERROR, parse_int_values(), res, and t.
bool test_vcomp | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 939 of file imdrover.c.
References ACHECK, FAIL, g_output, mp_int_compare_value, OTHER_ERROR, parse_int_values(), res, and t.
bool test_zcomp | ( | testspec_t * | t, |
FILE * | ofp | ||
) |
Definition at line 925 of file imdrover.c.
References ACHECK, FAIL, g_output, mp_int_compare_zero, OTHER_ERROR, parse_int_values(), res, and t.