Polly 22.0.0git
imdrover.h
Go to the documentation of this file.
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;
38 char **input;
40 char **output;
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_ */
bool test_qtodec(testspec_t *t, FILE *ofp)
Definition imdrover.c:1400
bool test_qsubz(testspec_t *t, FILE *ofp)
Definition imdrover.c:1286
bool test_divv(testspec_t *t, FILE *ofp)
Definition imdrover.c:659
bool test_mod(testspec_t *t, FILE *ofp)
Definition imdrover.c:729
bool test_sqrt(testspec_t *t, FILE *ofp)
Definition imdrover.c:807
bool test_abs(testspec_t *t, FILE *ofp)
Definition imdrover.c:497
bool test_comp(testspec_t *t, FILE *ofp)
Definition imdrover.c:897
bool(* test_f)(testspec_t *, FILE *)
Definition imdrover.h:43
bool test_div(testspec_t *t, FILE *ofp)
Definition imdrover.c:615
bool test_read_uns(testspec_t *t, FILE *ofp)
Definition imdrover.c:1101
bool test_mul(testspec_t *t, FILE *ofp)
Definition imdrover.c:555
bool test_qaddz(testspec_t *t, FILE *ofp)
Definition imdrover.c:1264
bool test_exptf(testspec_t *t, FILE *ofp)
Definition imdrover.c:715
bool test_exptmod_ev(testspec_t *t, FILE *ofp)
Definition imdrover.c:865
bool test_qdivz(testspec_t *t, FILE *ofp)
Definition imdrover.c:1330
bool test_qdiv(testspec_t *t, FILE *ofp)
Definition imdrover.c:1250
bool test_set(testspec_t *t, FILE *ofp)
Definition imdrover.c:458
bool test_vcomp(testspec_t *t, FILE *ofp)
Definition imdrover.c:939
bool test_invmod(testspec_t *t, FILE *ofp)
Definition imdrover.c:837
bool test_zcomp(testspec_t *t, FILE *ofp)
Definition imdrover.c:925
bool test_qmul(testspec_t *t, FILE *ofp)
Definition imdrover.c:1236
bool test_sqr(testspec_t *t, FILE *ofp)
Definition imdrover.c:601
bool test_init(testspec_t *t, FILE *ofp)
Definition imdrover.c:434
bool test_add(testspec_t *t, FILE *ofp)
Definition imdrover.c:512
bool test_qadd(testspec_t *t, FILE *ofp)
Definition imdrover.c:1208
bool test_expt(testspec_t *t, FILE *ofp)
Definition imdrover.c:682
bool test_gcd(testspec_t *t, FILE *ofp)
Definition imdrover.c:743
bool test_neg(testspec_t *t, FILE *ofp)
Definition imdrover.c:482
bool test_qtostr(testspec_t *t, FILE *ofp)
Definition imdrover.c:1376
bool test_exptmod_bv(testspec_t *t, FILE *ofp)
Definition imdrover.c:881
bool test_to_uint(testspec_t *t, FILE *ofp)
Definition imdrover.c:1036
bool test_read_binary(testspec_t *t, FILE *ofp)
Definition imdrover.c:1051
bool test_ucomp(testspec_t *t, FILE *ofp)
Definition imdrover.c:911
bool test_lcm(testspec_t *t, FILE *ofp)
Definition imdrover.c:793
bool test_egcd(testspec_t *t, FILE *ofp)
Definition imdrover.c:757
bool test_qrecip(testspec_t *t, FILE *ofp)
Definition imdrover.c:1180
bool test_tostr(testspec_t *t, FILE *ofp)
Definition imdrover.c:971
bool test_mulv(testspec_t *t, FILE *ofp)
Definition imdrover.c:585
bool test_qexpt(testspec_t *t, FILE *ofp)
Definition imdrover.c:1352
bool test_qmulz(testspec_t *t, FILE *ofp)
Definition imdrover.c:1308
bool test_meta(testspec_t *t, FILE *ofp)
Definition imdrover.c:1121
bool test_uvcomp(testspec_t *t, FILE *ofp)
Definition imdrover.c:955
bool test_divp2(testspec_t *t, FILE *ofp)
Definition imdrover.c:636
bool test_is_prime(testspec_t *t, FILE *ofp)
Definition imdrover.c:1453
bool test_to_int(testspec_t *t, FILE *ofp)
Definition imdrover.c:1021
bool test_qrdec(testspec_t *t, FILE *ofp)
Definition imdrover.c:1436
bool test_qneg(testspec_t *t, FILE *ofp)
Definition imdrover.c:1166
bool test_mulp2(testspec_t *t, FILE *ofp)
Definition imdrover.c:569
bool test_qabs(testspec_t *t, FILE *ofp)
Definition imdrover.c:1194
void init_testing(void)
Definition imdrover.c:411
bool test_root(testspec_t *t, FILE *ofp)
Definition imdrover.c:821
bool test_sub(testspec_t *t, FILE *ofp)
Definition imdrover.c:534
bool test_qsub(testspec_t *t, FILE *ofp)
Definition imdrover.c:1222
bool test_tobin(testspec_t *t, FILE *ofp)
Definition imdrover.c:991
bool test_exptmod(testspec_t *t, FILE *ofp)
Definition imdrover.c:851
bool test_exptv(testspec_t *t, FILE *ofp)
Definition imdrover.c:698
bool test_to_uns(testspec_t *t, FILE *ofp)
Definition imdrover.c:1071
void reset_registers(void)
Definition imdrover.c:427
t0 *a *b *t *a *b * t
char ** output
Definition imdrover.h:40
int num_outputs
Definition imdrover.h:39
int num_inputs
Definition imdrover.h:37
char * code
Definition imdrover.h:36
char ** input
Definition imdrover.h:38
char * file
Definition imdrover.h:35