1/*
2 Name: imdrover.h
3 Purpose: Keeper of the hordes of testing code.
4 Author: M. J. Fromberger
5
6 Copyright (C) 2002-2007 Michael J. Fromberger, All Rights Reserved.
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25 */
26
27#ifndef IMDROVER_H_
28#define IMDROVER_H_
29
30#include <stdbool.h>
31#include <stdio.h>
32
33typedef struct {
34 int line;
35 char *file;
36 char *code;
37 int num_inputs;
38 char **input;
39 int num_outputs;
40 char **output;
41} testspec_t;
42
43typedef bool (*test_f)(testspec_t *, FILE *);
44
45/* Call this once at the outset to set up test registers */
46void init_testing(void);
47void reset_registers(void);
48
49/* Integer tests, and general */
50bool test_init(testspec_t* t, FILE* ofp);
51bool test_set(testspec_t* t, FILE* ofp);
52bool test_neg(testspec_t* t, FILE* ofp);
53bool test_abs(testspec_t* t, FILE* ofp);
54bool test_add(testspec_t* t, FILE* ofp);
55bool test_sub(testspec_t* t, FILE* ofp);
56bool test_mul(testspec_t* t, FILE* ofp);
57bool test_mulp2(testspec_t* t, FILE* ofp);
58bool test_mulv(testspec_t* t, FILE* ofp);
59bool test_sqr(testspec_t* t, FILE* ofp);
60bool test_div(testspec_t* t, FILE* ofp);
61bool test_divp2(testspec_t* t, FILE* ofp);
62bool test_divv(testspec_t* t, FILE* ofp);
63bool test_expt(testspec_t* t, FILE* ofp);
64bool test_exptv(testspec_t* t, FILE* ofp);
65bool test_exptf(testspec_t* t, FILE* ofp);
66bool test_mod(testspec_t* t, FILE* ofp);
67bool test_gcd(testspec_t* t, FILE* ofp);
68bool test_egcd(testspec_t* t, FILE* ofp);
69bool test_lcm(testspec_t* t, FILE* ofp);
70bool test_sqrt(testspec_t* t, FILE* ofp);
71bool test_root(testspec_t* t, FILE* ofp);
72bool test_invmod(testspec_t* t, FILE* ofp);
73bool test_exptmod(testspec_t* t, FILE* ofp);
74bool test_exptmod_ev(testspec_t* t, FILE* ofp);
75bool test_exptmod_bv(testspec_t* t, FILE* ofp);
76bool test_comp(testspec_t* t, FILE* ofp);
77bool test_ucomp(testspec_t* t, FILE* ofp);
78bool test_zcomp(testspec_t* t, FILE* ofp);
79bool test_vcomp(testspec_t* t, FILE* ofp);
80bool test_uvcomp(testspec_t* t, FILE* ofp);
81bool test_tostr(testspec_t* t, FILE* ofp);
82bool test_tobin(testspec_t* t, FILE* ofp);
83bool test_to_int(testspec_t* t, FILE* ofp);
84bool test_to_uint(testspec_t* t, FILE* ofp);
85bool test_read_binary(testspec_t* t, FILE* ofp);
86bool test_to_uns(testspec_t* t, FILE* ofp);
87bool test_read_uns(testspec_t* t, FILE* ofp);
88bool test_meta(testspec_t* t, FILE* ofp);
89
90/* Rational tests */
91bool test_qneg(testspec_t* t, FILE* ofp);
92bool test_qrecip(testspec_t* t, FILE* ofp);
93bool test_qabs(testspec_t* t, FILE* ofp);
94bool test_qadd(testspec_t* t, FILE* ofp);
95bool test_qsub(testspec_t* t, FILE* ofp);
96bool test_qmul(testspec_t* t, FILE* ofp);
97bool test_qdiv(testspec_t* t, FILE* ofp);
98bool test_qdiv(testspec_t* t, FILE* ofp);
99bool test_qaddz(testspec_t* t, FILE* ofp);
100bool test_qsubz(testspec_t* t, FILE* ofp);
101bool test_qmulz(testspec_t* t, FILE* ofp);
102bool test_qdivz(testspec_t* t, FILE* ofp);
103bool test_qexpt(testspec_t* t, FILE* ofp);
104bool test_qtostr(testspec_t* t, FILE* ofp);
105bool test_qtodec(testspec_t* t, FILE* ofp);
106bool test_qrdec(testspec_t* t, FILE* ofp);
107
108/* Primality testing tests */
109bool test_is_prime(testspec_t* t, FILE *ofp);
110
111#endif /* IMDROVER_H_ */
112

source code of polly/lib/External/isl/imath/imdrover.h