Makefile: meilleures dependances.

arith: tester les comparaisons flottantes inversees et directes.
Tester sur +infty, -infty et NaN.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@483 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1995-11-28 14:26:41 +00:00
parent e5ef0b6f16
commit f02eee8156
3 changed files with 33 additions and 6 deletions

View File

@ -67,6 +67,8 @@ beforedepend:: lexcmm.ml
# The test programs
$(PROGS:.out=.o): codegen
fib.out: main.c fib.o $(ARCH).o
$(CC) $(CFLAGS) -o fib.out -DINT_INT -DFUN=fib main.c fib.o $(ARCH).o

View File

@ -148,6 +148,13 @@
(seq (checkbound y 5) (addraset r 90 1))
(addraset r 90 0))
(addraset r 91 (let res 1 (if (==f f g) [] (assign res 0)) res))
(addraset r 92 (let res 1 (if (!=f f g) [] (assign res 0)) res))
(addraset r 93 (let res 1 (if (<f f g) [] (assign res 0)) res))
(addraset r 94 (let res 1 (if (>f f g) [] (assign res 0)) res))
(addraset r 95 (let res 1 (if (<=f f g) [] (assign res 0)) res))
(addraset r 96 (let res 1 (if (>=f f g) [] (assign res 0)) res))
)))))))

View File

@ -21,14 +21,14 @@ double f, g;
#define INTTEST(arg,res) \
{ long result = (res); \
if (arg != result) \
printf("Failed test \"%s == %s\": result %ld, expected %ld\n", \
#arg, #res, arg, result); \
printf("Failed test \"%s == %s\" for x=%ld and y=%ld: result %ld, expected %ld\n", \
#arg, #res, x, y, arg, result); \
}
#define FLOATTEST(arg,res) \
{ double result = (res); \
if (arg != result) \
printf("Failed test \"%s == %s\": result %e, expected %e\n", \
#arg, #res, arg, result); \
printf("Failed test \"%s == %s\" for f=%g and g=%g: result %e, expected %e\n", \
#arg, #res, f, g, arg, result); \
}
extern void call_gen_code();
@ -157,6 +157,13 @@ void do_test()
INTTEST(r[88], (x >= 0) && (x < y));
INTTEST(r[89], (0 < y));
INTTEST(r[90], (5 < y));
INTTEST(r[91], (f == g));
INTTEST(r[92], (f != g));
INTTEST(r[93], (f < g));
INTTEST(r[94], (f > g));
INTTEST(r[95], (f <= g));
INTTEST(r[96], (f >= g));
}
@ -165,11 +172,13 @@ int main(argc, argv)
int argc;
char ** argv;
{
double weird[4];
if (argc >= 5) {
x = atoi(argv[1]);
y = atoi(argv[2]);
sscanf(argv[3], "%f", &f);
sscanf(argv[4], "%f", &g);
sscanf(argv[3], "%lf", &f);
sscanf(argv[4], "%lf", &g);
do_test();
return 0;
}
@ -178,6 +187,15 @@ int main(argc, argv)
f = x; g = y; do_test();
}
}
weird[0] = 0.0;
weird[1] = 1.0 / 0.0; /* +infty */
weird[2] = -1.0 / 0.0; /* -infty */
weird[3] = 0.0 / 0.0; /* NaN */
for (x = 0; x < 4; x++) {
for (y = 0; y < 4; y++) {
f = weird[x]; g = weird[y]; do_test();
}
}
while(1) {
x = rand() & 0x1FFFFFFF - 0x10000000;
y = rand() & 0x1FFFFFFF - 0x10000000;