Regression tests for 2 bugs.

Estimated hours taken: 3

Regression tests for 2 bugs.

Mmake:
	Add these two tests.

ho_func_reg.m:
ho_func_reg.exp:
	Check for correct creation of references to higher order
	function types with arity other than two.

float_reg.m:
float_reg.exp:
	Check for correct creation of floating point constants with
	a + in their exponent.
This commit is contained in:
Tyson Dowd
1997-01-08 01:40:33 +00:00
parent bbe8f401d7
commit 1ca63fc055
5 changed files with 73 additions and 1 deletions

View File

@@ -11,7 +11,8 @@ PROGS= qual_basic_test qual_basic_test2 qual_is_test qual_adv_test \
free_free_mode func_test string_alignment tim_qual1 c_write_string \
no_fully_strict float_rounding_bug string_loop func_and_pred \
cc_nondet_disj bidirectional address_of_builtins \
reverse_arith curry curry2 higher_order_syntax
reverse_arith curry curry2 higher_order_syntax \
ho_func_reg float_reg
#-----------------------------------------------------------------------------#

View File

@@ -0,0 +1 @@
2.88000000000000e+32

View File

@@ -0,0 +1,27 @@
% Regression test:
%
% Test case for creation of float constants.
%
% The Mercury compiler of 21 December 1996 failed to compile this on
% SPARC platforms, because the + in the float name was not converted
% correctly. This leads to syntax errors in the generated C code,
% eg
% flo.c:22: syntax error before `+'
% flo.c:23: `mercury_float_const_2pt88e' undeclared (first use this function)
%
% Author: trd
:- module float_reg.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module io, float.
main -->
io__write_float(2.88e32),
io__write_string("\n").

View File

@@ -0,0 +1,2 @@
I seem to have compiled ok.
8 seems to be the answer

View File

@@ -0,0 +1,41 @@
% Regression test:
%
% This program uses a higher order function. Due to the way higher order
% types are represented as terms (which is quite different from any
% other type) manipulations of types that don't take this into account
% would make mistakes.
%
% The Mercury compiler of 20 December, 1996 failed to compile this,
% giving link errors.
:- module ho_func_reg.
:- interface.
:- import_module int, io.
:- pred main(io__state::di, io__state::uo) is det.
:- type bar == (func(int) = int).
:- inst bar = (func(in) = out is det).
:- func foo(bar, int) = int is det.
:- mode foo(in(bar), in) = out is det.
:- func next(int) = int is det.
:- implementation.
main -->
io__write_string("I seem to have compiled ok.\n"),
{ Eight = foo(next, 7) },
io__write_int(Eight),
io__write_string(" seems to be the answer\n").
next(I) = I + 1.
foo(F, I) = apply(F, I).