[m-dev.] diff: fix tests in hard_coded for MSVC

Peter Ross peter.ross at miscrit.be
Wed Feb 14 02:58:17 AEDT 2001


Hi,


===================================================================


Estimated hours taken: 8

Adapt the tests in the hard_coded directory so that the version of the
Mercury compiler built with MSVC passes them in the hlc.gc grade.

tests/hard_coded/deep_copy.exp2:
tests/hard_coded/expand.exp2:
tests/hard_coded/float_reg.exp2:
tests/hard_coded/string_loop.exp2:
tests/hard_coded/write.exp2:
tests/hard_coded/write_reg1.exp2:
    The MSVC runtime prints out floating points using three digits for
    the exponent instead of two for most other runtimes.

tests/hard_coded/remove_file.m:
    s/io__tmp_name/io__make_tmp/ as tmp_name is obsolete.

tests/hard_coded/Mmakefile:
    Remove test_bitset and add bitset.

tests/hard_coded/bitset.exp:
tests/hard_coded/bitset.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/test_bitset.exp:
tests/hard_coded/test_bitset.m:
    Move this test into one test case because mmake falls over with
    unable to make `std_util.m^M', plus there is no reason to have this
    case spread over two files.

tests/hard_coded/exceptions/test_exceptions_func.m:
    Remove the uneeded import of std_util, this avoids the
    `std_util.m^M' problem mentioned in the previous test case.

Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.109
diff -u -r1.109 Mmakefile
--- Mmakefile	2001/01/07 03:05:46	1.109
+++ Mmakefile	2001/02/13 15:51:31
@@ -12,6 +12,7 @@
 	agg \
 	bidirectional \
 	bigtest \
+	bitset \
 	boyer \
 	c_write_string \
 	cc_and_non_cc_test \
@@ -106,7 +107,6 @@
 	string_loop \
 	term_io_test \
 	term_to_univ_test \
-	test_bitset \
 	test_imported_no_tag \
 	tim_qual1 \
 	tuple_test \
Index: bitset.exp
===================================================================
RCS file: bitset.exp
diff -N bitset.exp
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ bitset.exp	Wed Feb 14 02:51:31 2001
@@ -0,0 +1,89 @@
+List1: -59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 39, 40, 42, 44, 47, 58, 59
+
+List2: -64, -61, -58, -56, -51, -49, -48, -46, -44, -40, -38, -37, -31, -30, -23, -18, -13, -4, -2, 4, 9, 11, 12, 14, 17, 21, 23, 37, 39, 42, 43, 50, 52, 53, 54, 55, 56, 57, 61, 63
+
+count: 22 40
+testing foldl
+Sum of List1 = 471
+Sum of List2 = 60
+testing union
+[-64, -61, -59, -58, -56, -51, -49, -48, -46, -44, -40, -38, -37, -34, -31, -30, -23, -19, -18, -15, -13, -4, -2, 2, 4, 7, 9, 11, 12, 14, 17, 19, 21, 22, 23, 25, 28, 29, 31, 32, 36, 37, 38, 39, 40, 42, 43, 44, 47, 50, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63]
+testing intersection
+[39, 42]
+testing difference
+[-59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 40, 44, 47, 58, 59]
+testing remove_least_element
+-59
+[-34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 39, 40, 42, 44, 47, 58, 59]
+testing delete_list
+[-59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 40, 44, 47, 58, 59]
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
+count: 20 40
+testing foldl
+testing union
+testing intersection
+testing difference
+testing remove_least_element
+testing delete_list
Index: bitset.m
===================================================================
RCS file: bitset.m
diff -N bitset.m
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ bitset.m	Wed Feb 14 02:51:31 2001
@@ -0,0 +1,463 @@
+:- module bitset.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- import_module bool, exception, enum, int, list.
+:- import_module random, require, set, std_util.
+:- import_module sparse_bitset.
+
+:- func list1 = list(int).
+
+list1 = [29, 28, 31, 22, -15, 32, 19, 58, -59, 36, 7, 39, 42,
+		-34, 25, 40, 59, 2, -19, 44, 47, 38].
+
+:- func list2 = list(int).
+
+list2 = [21, 52, 23, -18, -23, 56, 11, -46, 61, -4, 63, 54, 17, -64,
+		-13, -38, 37, 4, 39, -2, 57, -56, -37, -30, -51, 12, -49,
+		-58, -31, -48, -61, 42, 53, -44, 55, 14, 9, -40, 43, 50].
+
+main -->
+	% Run one lot of tests with known input lists,
+	% to generate some visible output.
+	{ Write = yes },
+	run_test(Write, list1, list2),
+
+	% Run some more tests with random input, checking
+	% the output against that of set_ordlist.
+	{ Iterations = 10 },
+	{ random__init(1, Supply) },
+	run_tests(Iterations, Supply).
+
+:- pred run_tests(int::in, random__supply::mdi,
+		io__state::di, io__state::uo) is det.
+
+run_tests(Iterations, Supply0) -->
+	( { Iterations = 0 } ->
+		[]
+	;
+		{ Num1 = 20 },
+		{ get_random_numbers(Num1, [], List1, Supply0, Supply1) },
+		{ Num2 = 40 },
+		{ get_random_numbers(Num2, [], List2, Supply1, Supply) },
+		
+		{ Write = no },
+		run_test(Write, List1, List2),
+
+
+		run_tests(Iterations - 1, Supply)
+	).
+
+:- pred get_random_numbers(int::in, list(int)::in, list(int)::out,
+		random__supply::mdi, random__supply::muo) is det.
+
+get_random_numbers(Num, List0, List, Supply0, Supply) :-
+	( Num = 0 ->
+		List = List0,
+		Supply = Supply0
+	;
+		random__random(N, Supply0, Supply1),
+		RN = N rem 128 - 64,	% test negative numbers
+		get_random_numbers(Num - 1, [RN | List0], List,
+			Supply1, Supply)
+	).
+
+:- pred run_test(bool::in, list(int)::in, list(int)::in,
+		io__state::di, io__state::uo) is det.
+
+run_test(Write, List1, List2) -->
+	( { Write = yes } ->
+		io__write_string("List1: "),
+		io__write_list(list__sort(List1), ", ", io__write_int),
+		io__nl, io__nl,
+		io__write_string("List2: "),
+		io__write_list(list__sort(List2), ", ", io__write_int),
+		io__nl, io__nl
+	;
+		[]	
+	),
+	{ Set1 = list_to_set(List1) },
+	{ Set2 = list_to_set(List2) },
+
+	io__write_string("count: "),
+	io__write_int(count(Set1)),
+	io__write_string(" "),
+	io__write_int(count(Set2)),
+	io__nl,
+
+	io__write_string("testing foldl\n"),
+	{ Sum = (func(Elem, Acc) = Elem + Acc) },
+	{ Result1 = foldl(Sum, Set1, 0) },
+	{ Result2 = foldl(Sum, Set2, 0) },
+	( { Write = yes } ->
+		io__write_string("Sum of List1 = "),
+		io__write_int(Result1),
+		io__nl,
+		io__write_string("Sum of List2 = "),
+		io__write_int(Result2),
+		io__nl
+	;
+		[]
+	),
+
+	io__write_string("testing union\n"),
+	{ Union = union(Set1, Set2) },
+	write_bitset_result(Write, Union),
+
+	io__write_string("testing intersection\n"),
+	{ Intersection = intersect(Set1, Set2) },
+	write_bitset_result(Write, Intersection),
+
+	io__write_string("testing difference\n"),
+	{ Difference = difference(Set1, Set2) },
+	write_bitset_result(Write, Difference),
+
+	io__write_string("testing remove_least_element\n"),
+	( { remove_least(Set1, Least, RemovedLeast) } ->
+		( { Write = yes } ->
+			io__write_int(Least),
+			io__nl
+		;
+			[]
+		),
+		write_bitset_result(Write, RemovedLeast)
+	;
+		{ error("remove_least failed") }
+	),
+
+	io__write_string("testing delete_list\n"),
+	{ Delete = delete_list(Set1, List2) },
+	write_bitset_result(Write, Delete),
+
+	{ require(unify(delete_list(Set1, List1),
+			init `with_type` bitset_tester(int)),
+		"delete_list_failed") }.
+
+:- pred write_bitset_result(bool::in, bitset_tester(int)::in,
+		io__state::di, io__state::uo) is det.
+:- pragma no_inline(write_bitset_result/4).
+	
+write_bitset_result(Write, Set) -->
+	( { Write = yes } ->
+		{ List `with_type` list(int) = to_sorted_list(Set) },
+		io__write(List),
+		io__nl
+	;
+		[]
+	).
+
+:- type bitset_tester(T).
+
+:- type bitset_error(T)
+	--->	one_argument(string,
+			bitset_tester(T), bitset_tester(T))
+	;	two_arguments(string, bitset_tester(T),
+			bitset_tester(T), bitset_tester(T)).
+
+:- func init = bitset_tester(T).
+:- func insert(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
+:- func insert_list(bitset_tester(T), list(T)) =
+		bitset_tester(T) <= enum(T).
+:- func list_to_set(list(T)) = bitset_tester(T) <= enum(T).
+:- func sorted_list_to_set(list(T)) = bitset_tester(T) <= enum(T).
+:- func delete(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
+:- func delete_list(bitset_tester(T), list(T)) =
+			bitset_tester(T) <= enum(T).
+:- func remove(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
+:- mode remove(in, in) = out is semidet.
+:- func remove_list(bitset_tester(T), list(T)) =
+			bitset_tester(T) <= enum(T).
+:- mode remove_list(in, in) = out is semidet.
+
+:- func to_sorted_list(bitset_tester(T)) = list(T) <= enum(T).
+
+:- func singleton_set(T) = bitset_tester(T) <= enum(T).
+
+:- func union(bitset_tester(T), bitset_tester(T)) =
+		bitset_tester(T) <= enum(T).
+:- func intersect(bitset_tester(T), bitset_tester(T)) =
+		bitset_tester(T) <= enum(T).
+:- func difference(bitset_tester(T),
+		bitset_tester(T)) = bitset_tester(T) <= enum(T).
+
+:- pred remove_least(bitset_tester(T), T, bitset_tester(T)) <= enum(T).
+:- mode remove_least(in, out, out) is semidet.
+
+:- pred subset(bitset_tester(T), bitset_tester(T)).
+:- mode subset(in, in) is semidet.
+
+:- pred superset(bitset_tester(T), bitset_tester(T)).
+:- mode superset(in, in) is semidet.
+
+:- func count(bitset_tester(T)) = int <= enum(T).
+
+:- func foldl(func(T, U) = U, bitset_tester(T), U) = U <= enum(T).
+
+:- pred empty(bitset_tester(T)).
+:- mode empty(in) is semidet.
+
+:- pred contains(bitset_tester(T)::in, T::in) is semidet <= enum(T).
+
+:- pred init(bitset_tester(T)::out) is det.
+:- pred singleton_set(bitset_tester(T)::out, T::in) is det <= enum(T).
+
+:- pred list_to_set(list(T)::in, bitset_tester(T)::out) is det <= enum(T).
+:- pred sorted_list_to_set(list(T)::in,
+		bitset_tester(T)::out) is det <= enum(T).
+:- pred to_sorted_list(bitset_tester(T)::in,
+		list(T)::out) is det <= enum(T).
+:- pred insert(bitset_tester(T)::in, T::in,
+		bitset_tester(T)::out) is det <= enum(T).
+:- pred insert_list(bitset_tester(T)::in,
+		list(T)::in, bitset_tester(T)::out) is det <= enum(T).
+:- pred delete(bitset_tester(T)::in, T::in,
+		bitset_tester(T)::out) is det <= enum(T).
+:- pred delete_list(bitset_tester(T)::in, list(T)::in,
+		bitset_tester(T)::out) is det <= enum(T).
+:- pred union(bitset_tester(T)::in,
+		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
+:- pred intersect(bitset_tester(T)::in,
+		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
+:- pred difference(bitset_tester(T)::in,
+		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
+
+:- type bitset_tester(T) == pair(sparse_bitset(T), set__set(T)).
+
+%-----------------------------------------------------------------------------%
+
+init = init - init.
+
+singleton_set(A) = make_singleton_set(A) - make_singleton_set(A).
+
+init(init).
+empty(A - B) :-
+	( empty(A) -> EmptyA = yes; EmptyA = no),
+	( empty(B) -> EmptyB = yes; EmptyB = no),
+	( EmptyA = EmptyB ->
+		EmptyA = yes
+	;
+		error("empty failed")
+	).
+singleton_set(singleton_set(A), A).
+insert(A, B, insert(A, B)).
+insert_list(A, B, insert_list(A, B)).
+delete(A, B, delete(A, B)).
+delete_list(A, B, delete_list(A, B)).
+list_to_set(A, list_to_set(A)).
+to_sorted_list(A, to_sorted_list(A)).
+sorted_list_to_set(A, sorted_list_to_set(A)).
+union(A, B, union(A, B)).
+intersect(A, B, intersect(A, B)).
+difference(A, B, difference(A, B)).
+
+%-----------------------------------------------------------------------------%
+
+to_sorted_list(A - B) = List :-
+	ListA = to_sorted_list(A),
+	ListB = set__to_sorted_list(B),
+	( ListA = ListB ->
+		List = ListB
+	;
+		error("to_sorted_list failed")
+	).
+
+%-----------------------------------------------------------------------------%
+
+delete(SetA - SetB, Var) = check("delete", SetA - SetB, delete(SetA, Var) - set__delete(SetB, Var)).
+
+delete_list(SetA - SetB, List) =
+	check("delete_list", SetA - SetB,
+		delete_list(SetA, List) - set__delete_list(SetB, List)).
+
+remove(SetA0 - SetB0, Elem) = Result :-
+	( SetA1 = remove(SetA0, Elem) ->
+		( remove(SetB0, Elem, SetB1) ->
+			SetA = SetA1,
+			SetB = SetB1
+		;
+			error("remove succeeded unexpectedly")
+		)
+	; set__remove(SetB0, Elem, _) ->
+		error("remove failed unexpectedly")
+	;
+		fail
+	),
+	Result = check("remove", SetA0 - SetB0, SetA - SetB).
+
+remove_list(SetA0 - SetB0, List) = Result :-
+	( SetA1 = remove_list(SetA0, List) ->
+		( set__remove_list(SetB0, List, SetB1) ->
+			SetA = SetA1,
+			SetB = SetB1
+		;
+			error("remove succeeded unexpectedly")
+		)
+	; set__remove_list(SetB0, List, _) ->
+		error("remove failed unexpectedly")
+	;
+		fail
+	),
+	Result = check("remove_list", SetA0 - SetB0, SetA - SetB).
+
+%-----------------------------------------------------------------------------%
+
+insert(SetA - SetB, Var) = check("insert", SetA - SetB,
+		insert(SetA, Var) - set__insert(SetB, Var)).
+
+%-----------------------------------------------------------------------------%
+
+insert_list(SetA - SetB, Vars) = check("insert_list", SetA - SetB, insert_list(SetA, Vars) - set__insert_list(SetB, Vars)).
+
+%-----------------------------------------------------------------------------%
+
+list_to_set(List) = check("list_to_set", init - init,
+			list_to_set(List) - set__list_to_set(List)).
+
+sorted_list_to_set(List) = check("sorted_list_to_set", init - init,
+			sorted_list_to_set(List) - set__sorted_list_to_set(List)).
+
+%-----------------------------------------------------------------------------%
+
+contains(SetA - SetB, Var) :-
+	( contains(SetA, Var) -> InSetA = yes ; InSetA = no),
+	( set__contains(SetB, Var) -> InSetB = yes ; InSetB = no),
+	( InSetA = InSetB ->
+		InSetA = yes
+	;
+		error("contains failed")
+	).
+
+%-----------------------------------------------------------------------------%
+
+foldl(F, SetA - SetB, Acc0) = Acc :-
+	AccA = foldl(F, SetA, Acc0),
+	AccB = fold(F, SetB, Acc0),
+	( AccA = AccB ->
+		Acc = AccA
+	;	
+		error("bitset_tester: fold failed")
+	).
+
+%-----------------------------------------------------------------------------%
+
+count(SetA - SetB) = Count :-
+	CountA = count(SetA),
+	CountB = count(SetB),
+	( CountA = CountB ->
+		Count = CountA
+	;	
+		error("bitset_tester: count failed")
+	).
+
+%-----------------------------------------------------------------------------%
+
+subset(SetA1 - SetB1, SetA2 - SetB2) :-
+	( subset(SetA1, SetA2) ->
+		( subset(SetB1, SetB2) ->
+			true
+		;	
+			error("bitset_tester: subset succeeded unexpectedly")
+		)
+	; subset(SetB1, SetB2) ->
+		error("bitset_tester: subset failed unexpectedly")
+	;
+		fail
+	).
+
+superset(SetA1 - SetB1, SetA2 - SetB2) :-
+	( superset(SetA1, SetA2) ->
+		( superset(SetB1, SetB2) ->
+			true
+		;	
+			error("bitset_tester: superset succeeded unexpectedly")
+		)
+	; superset(SetB1, SetB2) ->
+		error("bitset_tester: superset failed unexpectedly")
+	;
+		fail
+	).
+
+%-----------------------------------------------------------------------------%
+
+union(SetA1 - SetB1, SetA2 - SetB2) =
+		check2("union", SetA1 - SetB1, SetA2 - SetB2,
+			union(SetA1, SetA2) - set__union(SetB1, SetB2)).
+
+%-----------------------------------------------------------------------------%
+
+intersect(SetA1 - SetB1, SetA2 - SetB2) =
+		check2("intersect", SetA1 - SetB1, SetA2 - SetB2,
+			intersect(SetA1, SetA2) - set__intersect(SetB1, SetB2)).
+
+%-----------------------------------------------------------------------------%
+
+difference(SetA1 - SetB1, SetA2 - SetB2) =
+		check2("difference", SetA1 - SetB1, SetA2 - SetB2,
+			difference(SetA1, SetA2) - set__difference(SetB1, SetB2)).
+
+%-----------------------------------------------------------------------------%
+
+remove_least(SetA0 - SetB0, Least, SetA - SetB) :-
+	( remove_least(SetA0, LeastA, SetA1) ->
+		( remove_least(SetB0, LeastB, SetB1) ->
+			( LeastA = LeastB ->
+				SetA = SetA1,
+				SetB = SetB1,
+				Least = LeastA
+			;
+				error("remove_least: wrong least element")
+			)
+		;
+			error("remove_least: should be no least value")
+		)
+	; remove_least(SetB0, _, _) ->
+		error("remove_least: failed")
+	;
+		fail
+	).
+
+%-----------------------------------------------------------------------------%
+
+:- func check(string, bitset_tester(T), bitset_tester(T)) =
+		bitset_tester(T) <= enum(T).
+
+check(Op, Tester1, Tester) = Tester :-
+
+	Tester1 = BitSet1 - Set1,
+	BitSetSet1 =
+		sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set1)),
+	Tester = BitSet - Set,
+	BitSetSet = sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set)),
+	( BitSetSet1 = BitSet1, BitSet = BitSetSet ->
+		true
+	;
+		throw(one_argument(Op, Tester1, Tester))
+	).
+
+:- func check2(string, bitset_tester(T), bitset_tester(T),
+		bitset_tester(T)) = bitset_tester(T) <= enum(T).
+
+check2(Op, Tester1, Tester2, Tester) = Result :-
+	Tester1 = BitSet1 - Set1,
+	BitSetSet1 =
+		sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set1)),
+	Tester2 = BitSet2 - Set2,
+	BitSetSet2 = sorted_list_to_set(
+		set__to_sorted_list(Set2)),
+
+	Tester = BitSet - Set,
+	BitSetSet = sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set)),
+
+	( BitSetSet1 = BitSet1, BitSetSet2 = BitSet2, BitSet = BitSetSet ->
+		Result = Tester
+	;
+		throw(two_arguments(Op, Tester1, Tester2, Tester))
+	).
+
+%-----------------------------------------------------------------------------%
Index: bitset_tester.m
===================================================================
RCS file: bitset_tester.m
diff -N bitset_tester.m
--- /tmp/cvskh2Tqj	Wed Feb 14 02:51:32 2001
+++ /dev/null	Sat Aug  7 21:45:41 1999
@@ -1,322 +0,0 @@
-% Test operations on bitsets by comparing the output with the output
-% from an ordinary set.
-:- module bitset_tester.
-
-:- interface.
-
-:- import_module enum, list.
-
-:- type bitset_tester(T).
-
-:- type bitset_error(T)
-	--->	one_argument(string,
-			bitset_tester(T), bitset_tester(T))
-	;	two_arguments(string, bitset_tester(T),
-			bitset_tester(T), bitset_tester(T)).
-
-:- func init = bitset_tester(T).
-:- func insert(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
-:- func insert_list(bitset_tester(T), list(T)) =
-		bitset_tester(T) <= enum(T).
-:- func list_to_set(list(T)) = bitset_tester(T) <= enum(T).
-:- func sorted_list_to_set(list(T)) = bitset_tester(T) <= enum(T).
-:- func delete(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
-:- func delete_list(bitset_tester(T), list(T)) =
-			bitset_tester(T) <= enum(T).
-:- func remove(bitset_tester(T), T) = bitset_tester(T) <= enum(T).
-:- mode remove(in, in) = out is semidet.
-:- func remove_list(bitset_tester(T), list(T)) =
-			bitset_tester(T) <= enum(T).
-:- mode remove_list(in, in) = out is semidet.
-
-:- func to_sorted_list(bitset_tester(T)) = list(T) <= enum(T).
-
-:- func singleton_set(T) = bitset_tester(T) <= enum(T).
-
-:- func union(bitset_tester(T), bitset_tester(T)) =
-		bitset_tester(T) <= enum(T).
-:- func intersect(bitset_tester(T), bitset_tester(T)) =
-		bitset_tester(T) <= enum(T).
-:- func difference(bitset_tester(T),
-		bitset_tester(T)) = bitset_tester(T) <= enum(T).
-
-:- pred remove_least(bitset_tester(T), T, bitset_tester(T)) <= enum(T).
-:- mode remove_least(in, out, out) is semidet.
-
-:- pred subset(bitset_tester(T), bitset_tester(T)).
-:- mode subset(in, in) is semidet.
-
-:- pred superset(bitset_tester(T), bitset_tester(T)).
-:- mode superset(in, in) is semidet.
-
-:- func count(bitset_tester(T)) = int <= enum(T).
-
-:- func foldl(func(T, U) = U, bitset_tester(T), U) = U <= enum(T).
-
-:- pred empty(bitset_tester(T)).
-:- mode empty(in) is semidet.
-
-:- pred contains(bitset_tester(T)::in, T::in) is semidet <= enum(T).
-
-:- pred init(bitset_tester(T)::out) is det.
-:- pred singleton_set(bitset_tester(T)::out, T::in) is det <= enum(T).
-
-:- pred list_to_set(list(T)::in, bitset_tester(T)::out) is det <= enum(T).
-:- pred sorted_list_to_set(list(T)::in,
-		bitset_tester(T)::out) is det <= enum(T).
-:- pred to_sorted_list(bitset_tester(T)::in,
-		list(T)::out) is det <= enum(T).
-:- pred insert(bitset_tester(T)::in, T::in,
-		bitset_tester(T)::out) is det <= enum(T).
-:- pred insert_list(bitset_tester(T)::in,
-		list(T)::in, bitset_tester(T)::out) is det <= enum(T).
-:- pred delete(bitset_tester(T)::in, T::in,
-		bitset_tester(T)::out) is det <= enum(T).
-:- pred delete_list(bitset_tester(T)::in, list(T)::in,
-		bitset_tester(T)::out) is det <= enum(T).
-:- pred union(bitset_tester(T)::in,
-		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
-:- pred intersect(bitset_tester(T)::in,
-		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
-:- pred difference(bitset_tester(T)::in,
-		bitset_tester(T)::in, bitset_tester(T)::out) is det <= enum(T).
-
-:- implementation.
-
-:- import_module bool, exception, list, int, require, set, std_util.
-:- import_module sparse_bitset.
-
-:- type bitset_tester(T) == pair(sparse_bitset(T), set__set(T)).
-
-%-----------------------------------------------------------------------------%
-
-init = init - init.
-
-singleton_set(A) = make_singleton_set(A) - make_singleton_set(A).
-
-init(init).
-empty(A - B) :-
-	( empty(A) -> EmptyA = yes; EmptyA = no),
-	( empty(B) -> EmptyB = yes; EmptyB = no),
-	( EmptyA = EmptyB ->
-		EmptyA = yes
-	;
-		error("empty failed")
-	).
-singleton_set(singleton_set(A), A).
-insert(A, B, insert(A, B)).
-insert_list(A, B, insert_list(A, B)).
-delete(A, B, delete(A, B)).
-delete_list(A, B, delete_list(A, B)).
-list_to_set(A, list_to_set(A)).
-to_sorted_list(A, to_sorted_list(A)).
-sorted_list_to_set(A, sorted_list_to_set(A)).
-union(A, B, union(A, B)).
-intersect(A, B, intersect(A, B)).
-difference(A, B, difference(A, B)).
-
-%-----------------------------------------------------------------------------%
-
-to_sorted_list(A - B) = List :-
-	ListA = to_sorted_list(A),
-	ListB = set__to_sorted_list(B),
-	( ListA = ListB ->
-		List = ListB
-	;
-		error("to_sorted_list failed")
-	).
-
-%-----------------------------------------------------------------------------%
-
-delete(SetA - SetB, Var) = check("delete", SetA - SetB, delete(SetA, Var) - set__delete(SetB, Var)).
-
-delete_list(SetA - SetB, List) =
-	check("delete_list", SetA - SetB,
-		delete_list(SetA, List) - set__delete_list(SetB, List)).
-
-remove(SetA0 - SetB0, Elem) = Result :-
-	( SetA1 = remove(SetA0, Elem) ->
-		( remove(SetB0, Elem, SetB1) ->
-			SetA = SetA1,
-			SetB = SetB1
-		;
-			error("remove succeeded unexpectedly")
-		)
-	; set__remove(SetB0, Elem, _) ->
-		error("remove failed unexpectedly")
-	;
-		fail
-	),
-	Result = check("remove", SetA0 - SetB0, SetA - SetB).
-
-remove_list(SetA0 - SetB0, List) = Result :-
-	( SetA1 = remove_list(SetA0, List) ->
-		( set__remove_list(SetB0, List, SetB1) ->
-			SetA = SetA1,
-			SetB = SetB1
-		;
-			error("remove succeeded unexpectedly")
-		)
-	; set__remove_list(SetB0, List, _) ->
-		error("remove failed unexpectedly")
-	;
-		fail
-	),
-	Result = check("remove_list", SetA0 - SetB0, SetA - SetB).
-
-%-----------------------------------------------------------------------------%
-
-insert(SetA - SetB, Var) = check("insert", SetA - SetB,
-		insert(SetA, Var) - set__insert(SetB, Var)).
-
-%-----------------------------------------------------------------------------%
-
-insert_list(SetA - SetB, Vars) = check("insert_list", SetA - SetB, insert_list(SetA, Vars) - set__insert_list(SetB, Vars)).
-
-%-----------------------------------------------------------------------------%
-
-list_to_set(List) = check("list_to_set", init - init,
-			list_to_set(List) - set__list_to_set(List)).
-
-sorted_list_to_set(List) = check("sorted_list_to_set", init - init,
-			sorted_list_to_set(List) - set__sorted_list_to_set(List)).
-
-%-----------------------------------------------------------------------------%
-
-contains(SetA - SetB, Var) :-
-	( contains(SetA, Var) -> InSetA = yes ; InSetA = no),
-	( set__contains(SetB, Var) -> InSetB = yes ; InSetB = no),
-	( InSetA = InSetB ->
-		InSetA = yes
-	;
-		error("contains failed")
-	).
-
-%-----------------------------------------------------------------------------%
-
-foldl(F, SetA - SetB, Acc0) = Acc :-
-	AccA = foldl(F, SetA, Acc0),
-	AccB = fold(F, SetB, Acc0),
-	( AccA = AccB ->
-		Acc = AccA
-	;	
-		error("bitset_tester: fold failed")
-	).
-
-%-----------------------------------------------------------------------------%
-
-count(SetA - SetB) = Count :-
-	CountA = count(SetA),
-	CountB = count(SetB),
-	( CountA = CountB ->
-		Count = CountA
-	;	
-		error("bitset_tester: count failed")
-	).
-
-%-----------------------------------------------------------------------------%
-
-subset(SetA1 - SetB1, SetA2 - SetB2) :-
-	( subset(SetA1, SetA2) ->
-		( subset(SetB1, SetB2) ->
-			true
-		;	
-			error("bitset_tester: subset succeeded unexpectedly")
-		)
-	; subset(SetB1, SetB2) ->
-		error("bitset_tester: subset failed unexpectedly")
-	;
-		fail
-	).
-
-superset(SetA1 - SetB1, SetA2 - SetB2) :-
-	( superset(SetA1, SetA2) ->
-		( superset(SetB1, SetB2) ->
-			true
-		;	
-			error("bitset_tester: superset succeeded unexpectedly")
-		)
-	; superset(SetB1, SetB2) ->
-		error("bitset_tester: superset failed unexpectedly")
-	;
-		fail
-	).
-
-%-----------------------------------------------------------------------------%
-
-union(SetA1 - SetB1, SetA2 - SetB2) =
-		check2("union", SetA1 - SetB1, SetA2 - SetB2,
-			union(SetA1, SetA2) - set__union(SetB1, SetB2)).
-
-%-----------------------------------------------------------------------------%
-
-intersect(SetA1 - SetB1, SetA2 - SetB2) =
-		check2("intersect", SetA1 - SetB1, SetA2 - SetB2,
-			intersect(SetA1, SetA2) - set__intersect(SetB1, SetB2)).
-
-%-----------------------------------------------------------------------------%
-
-difference(SetA1 - SetB1, SetA2 - SetB2) =
-		check2("difference", SetA1 - SetB1, SetA2 - SetB2,
-			difference(SetA1, SetA2) - set__difference(SetB1, SetB2)).
-
-%-----------------------------------------------------------------------------%
-
-remove_least(SetA0 - SetB0, Least, SetA - SetB) :-
-	( remove_least(SetA0, LeastA, SetA1) ->
-		( remove_least(SetB0, LeastB, SetB1) ->
-			( LeastA = LeastB ->
-				SetA = SetA1,
-				SetB = SetB1,
-				Least = LeastA
-			;
-				error("remove_least: wrong least element")
-			)
-		;
-			error("remove_least: should be no least value")
-		)
-	; remove_least(SetB0, _, _) ->
-		error("remove_least: failed")
-	;
-		fail
-	).
-
-%-----------------------------------------------------------------------------%
-
-:- func check(string, bitset_tester(T), bitset_tester(T)) =
-		bitset_tester(T) <= enum(T).
-
-check(Op, Tester1, Tester) = Tester :-
-
-	Tester1 = BitSet1 - Set1,
-	BitSetSet1 =
-		sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set1)),
-	Tester = BitSet - Set,
-	BitSetSet = sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set)),
-	( BitSetSet1 = BitSet1, BitSet = BitSetSet ->
-		true
-	;
-		throw(one_argument(Op, Tester1, Tester))
-	).
-
-:- func check2(string, bitset_tester(T), bitset_tester(T),
-		bitset_tester(T)) = bitset_tester(T) <= enum(T).
-
-check2(Op, Tester1, Tester2, Tester) = Result :-
-	Tester1 = BitSet1 - Set1,
-	BitSetSet1 =
-		sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set1)),
-	Tester2 = BitSet2 - Set2,
-	BitSetSet2 = sorted_list_to_set(
-		set__to_sorted_list(Set2)),
-
-	Tester = BitSet - Set,
-	BitSetSet = sparse_bitset__sorted_list_to_set(set__to_sorted_list(Set)),
-
-	( BitSetSet1 = BitSet1, BitSetSet2 = BitSet2, BitSet = BitSetSet ->
-		Result = Tester
-	;
-		throw(two_arguments(Op, Tester1, Tester2, Tester))
-	).
-
-%-----------------------------------------------------------------------------%
Index: deep_copy.exp2
===================================================================
RCS file: deep_copy.exp2
diff -N deep_copy.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ deep_copy.exp2	Wed Feb 14 02:51:31 2001
@@ -0,0 +1,113 @@
+TESTING DISCRIMINATED UNIONS
+two
+two
+two
+one
+one
+one
+three
+three
+three
+apple([9, 5, 1])
+apple([9, 5, 1])
+apple([9, 5, 1])
+banana([three, one, two])
+banana([three, one, two])
+banana([three, one, two])
+zop(3.30000000000000, 2.03000000000000)
+zop(3.30000000000000, 2.03000000000000)
+zop(3.30000000000000, 2.03000000000000)
+zip(3, 2)
+zip(3, 2)
+zip(3, 2)
+zap(3, -2.11100000000000)
+zap(3, -2.11100000000000)
+zap(3, -2.11100000000000)
+wombat
+wombat
+wombat
+foo
+foo
+foo
+tuple_a(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, 17)
+tuple_a(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, 17)
+tuple_a(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, 17)
+tuple_b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, ["x", "y", "z"])
+tuple_b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, ["x", "y", "z"])
+tuple_b(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ["a", "b", "c"], 16, ["x", "y", "z"])
+tuple_c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ["p", "q"], 17)
+tuple_c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ["p", "q"], 17)
+tuple_c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ["p", "q"], 17)
+tuple_d(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ["d", "e", "f"], 15, ["u", "v", "w"], 17)
+tuple_d(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ["d", "e", "f"], 15, ["u", "v", "w"], 17)
+tuple_d(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ["d", "e", "f"], 15, ["u", "v", "w"], 17)
+
+TESTING POLYMORPHISM
+poly_three(3.33000000000000, 4, poly_one(9.11000000000000))
+poly_three(3.33000000000000, 4, poly_one(9.11000000000000))
+poly_three(3.33000000000000, 4, poly_one(9.11000000000000))
+poly_two(3)
+poly_two(3)
+poly_two(3)
+poly_one([2399.30000000000])
+poly_one([2399.30000000000])
+poly_one([2399.30000000000])
+
+TESTING BUILTINS
+""
+""
+""
+"Hello, world\n"
+"Hello, world\n"
+"Hello, world\n"
+"Foo%sFoo"
+"Foo%sFoo"
+"Foo%sFoo"
+"\""
+"\""
+"\""
+'a'
+'a'
+'a'
+'&'
+'&'
+'&'
+3.14159000000000
+3.14159000000000
+3.14159000000000
+1.12832498300000e-021
+1.12832498300000e-021
+1.12832498300000e-021
+2.23954899000000e+023
+2.23954899000000e+023
+2.23954899000000e+023
+-65
+-65
+-65
+4
+4
+4
+univ_cons(["hi! I\'m a univ!"])
+univ_cons(["hi! I\'m a univ!"])
+univ_cons(["hi! I\'m a univ!"])
+{1, "two", '3', {4, '5', "6"}}
+{1, "two", '3', {4, '5', "6"}}
+{1, "two", '3', {4, '5', "6"}}
+
+TESTING OTHER TYPES
+var(1)
+var(1)
+var(1)
+var_supply(0)
+var_supply(0)
+var_supply(0)
+var_supply(1)
+var_supply(1)
+var_supply(1)
+empty
+empty
+empty
+qwerty(4)
+qwerty(4)
+qwerty(4)
+
Index: expand.exp2
===================================================================
RCS file: expand.exp2
diff -N expand.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ expand.exp2	Wed Feb 14 02:51:32 2001
@@ -0,0 +1,138 @@
+TESTING DISCRIMINATED UNIONS
+one/0
+no arguments
+expand: functor one arity 0 arguments []
+
+two/0
+no arguments
+expand: functor two arity 0 arguments []
+
+three/0
+no arguments
+expand: functor three arity 0 arguments []
+
+apple/1
+argument 1 of functor apple was:[9, 5, 1]
+expand: functor apple arity 1 arguments [[9, 5, 1]]
+
+banana/1
+argument 1 of functor banana was:[three, one, two]
+expand: functor banana arity 1 arguments [[three, one, two]]
+
+zop/2
+argument 2 of functor zop was:2.03000000000000
+expand: functor zop arity 2 arguments [3.30000000000000, 2.03000000000000]
+
+zip/2
+argument 2 of functor zip was:2
+expand: functor zip arity 2 arguments [3, 2]
+
+zap/2
+argument 2 of functor zap was:-2.11100000000000
+expand: functor zap arity 2 arguments [3, -2.11100000000000]
+
+wombat/0
+no arguments
+expand: functor wombat arity 0 arguments []
+
+foo/0
+no arguments
+expand: functor foo arity 0 arguments []
+
+
+TESTING POLYMORPHISM
+poly_two/1
+argument 1 of functor poly_two was:3
+expand: functor poly_two arity 1 arguments [3]
+
+poly_three/3
+argument 3 of functor poly_three was:poly_one(9.11000000000000)
+expand: functor poly_three arity 3 arguments [3.33000000000000, 4, poly_one(9.11000000000000)]
+
+poly_one/1
+argument 1 of functor poly_one was:[2399.30000000000]
+expand: functor poly_one arity 1 arguments [[2399.30000000000]]
+
+
+TESTING BUILTINS
+""/0
+no arguments
+expand: functor "" arity 0 arguments []
+
+"Hello, world
+"/0
+no arguments
+expand: functor "Hello, world
+" arity 0 arguments []
+
+"Foo%sFoo"/0
+no arguments
+expand: functor "Foo%sFoo" arity 0 arguments []
+
+"""/0
+no arguments
+expand: functor """ arity 0 arguments []
+
+'a'/0
+no arguments
+expand: functor 'a' arity 0 arguments []
+
+'&'/0
+no arguments
+expand: functor '&' arity 0 arguments []
+
+3.14159000000000/0
+no arguments
+expand: functor 3.14159000000000 arity 0 arguments []
+
+1.12832498300000e-021/0
+no arguments
+expand: functor 1.12832498300000e-021 arity 0 arguments []
+
+2.23954899000000e+023/0
+no arguments
+expand: functor 2.23954899000000e+023 arity 0 arguments []
+
+-65/0
+no arguments
+expand: functor -65 arity 0 arguments []
+
+4/0
+no arguments
+expand: functor 4 arity 0 arguments []
+
+univ_cons/1
+argument 1 of functor univ_cons was:["hi! I\'m a univ!"]
+expand: functor univ_cons arity 1 arguments [["hi! I\'m a univ!"]]
+
+<<predicate>>/0
+no arguments
+expand: functor <<predicate>> arity 0 arguments []
+
+{}/4
+argument 4 of functor {} was:{1, 2, 3, 4}
+expand: functor {} arity 4 arguments [1, 'b', "third", {1, 2, 3, 4}]
+
+
+TESTING OTHER TYPES
+var/1
+argument 1 of functor var was:1
+expand: functor var arity 1 arguments [1]
+
+var_supply/1
+argument 1 of functor var_supply was:0
+expand: functor var_supply arity 1 arguments [0]
+
+var_supply/1
+argument 1 of functor var_supply was:1
+expand: functor var_supply arity 1 arguments [1]
+
+empty/0
+no arguments
+expand: functor empty arity 0 arguments []
+
+qwerty/1
+argument 1 of functor qwerty was:4
+expand: functor qwerty arity 1 arguments [4]
+
+
Index: float_reg.exp2
===================================================================
RCS file: float_reg.exp2
diff -N float_reg.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ float_reg.exp2	Wed Feb 14 02:51:32 2001
@@ -0,0 +1,3 @@
+2.88000000000000e+032
+1.00000000000000e+032
+10000000000.0000
Index: remove_file.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/remove_file.m,v
retrieving revision 1.1
diff -u -r1.1 remove_file.m
--- remove_file.m	1998/01/22 02:26:53	1.1
+++ remove_file.m	2001/02/13 15:51:32
@@ -1,3 +1,7 @@
+% If this test fails when run natively under Win32 (no cygwin) then make
+% sure that either the TMPDIR environment variable points somewhere
+% sensible or that a directory <drive letter>:\tmp exists.
+
 :- module remove_file.
 :- interface.
 :- use_module io.
@@ -7,7 +11,7 @@
 :- implementation.
 
 main -->
-	io__tmpnam(Name),
+	io__make_temp(Name),
 %%%%%%%	io__print("Temp file name = "), io__print(Name), io__nl,
 	io__tell(Name, TellResult),
 	( { TellResult = io__ok },
Index: string_loop.exp2
===================================================================
RCS file: string_loop.exp2
diff -N string_loop.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ string_loop.exp2	Wed Feb 14 02:51:32 2001
@@ -0,0 +1 @@
+0.000000e+000i
Index: test_bitset.exp
===================================================================
RCS file: test_bitset.exp
diff -N test_bitset.exp
--- /tmp/cvs890N2x	Wed Feb 14 02:51:33 2001
+++ /dev/null	Sat Aug  7 21:45:41 1999
@@ -1,89 +0,0 @@
-List1: -59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 39, 40, 42, 44, 47, 58, 59
-
-List2: -64, -61, -58, -56, -51, -49, -48, -46, -44, -40, -38, -37, -31, -30, -23, -18, -13, -4, -2, 4, 9, 11, 12, 14, 17, 21, 23, 37, 39, 42, 43, 50, 52, 53, 54, 55, 56, 57, 61, 63
-
-count: 22 40
-testing foldl
-Sum of List1 = 471
-Sum of List2 = 60
-testing union
-[-64, -61, -59, -58, -56, -51, -49, -48, -46, -44, -40, -38, -37, -34, -31, -30, -23, -19, -18, -15, -13, -4, -2, 2, 4, 7, 9, 11, 12, 14, 17, 19, 21, 22, 23, 25, 28, 29, 31, 32, 36, 37, 38, 39, 40, 42, 43, 44, 47, 50, 52, 53, 54, 55, 56, 57, 58, 59, 61, 63]
-testing intersection
-[39, 42]
-testing difference
-[-59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 40, 44, 47, 58, 59]
-testing remove_least_element
--59
-[-34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 39, 40, 42, 44, 47, 58, 59]
-testing delete_list
-[-59, -34, -19, -15, 2, 7, 19, 22, 25, 28, 29, 31, 32, 36, 38, 40, 44, 47, 58, 59]
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
-count: 20 40
-testing foldl
-testing union
-testing intersection
-testing difference
-testing remove_least_element
-testing delete_list
Index: test_bitset.m
===================================================================
RCS file: test_bitset.m
diff -N test_bitset.m
--- /tmp/cvsB3PYMh	Wed Feb 14 02:51:33 2001
+++ /dev/null	Sat Aug  7 21:45:41 1999
@@ -1,152 +0,0 @@
-:- module test_bitset.
-
-:- interface.
-
-:- import_module io.
-
-:- pred main(io__state::di, io__state::uo) is det.
-
-:- implementation.
-
-:- import_module bool, enum, int, list, bitset_tester, random, require.
-
-:- func list1 = list(int).
-
-list1 = [29, 28, 31, 22, -15, 32, 19, 58, -59, 36, 7, 39, 42,
-		-34, 25, 40, 59, 2, -19, 44, 47, 38].
-
-:- func list2 = list(int).
-
-list2 = [21, 52, 23, -18, -23, 56, 11, -46, 61, -4, 63, 54, 17, -64,
-		-13, -38, 37, 4, 39, -2, 57, -56, -37, -30, -51, 12, -49,
-		-58, -31, -48, -61, 42, 53, -44, 55, 14, 9, -40, 43, 50].
-
-main -->
-	% Run one lot of tests with known input lists,
-	% to generate some visible output.
-	{ Write = yes },
-	run_test(Write, list1, list2),
-
-	% Run some more tests with random input, checking
-	% the output against that of set_ordlist.
-	{ Iterations = 10 },
-	{ random__init(1, Supply) },
-	run_tests(Iterations, Supply).
-
-:- pred run_tests(int::in, random__supply::mdi,
-		io__state::di, io__state::uo) is det.
-
-run_tests(Iterations, Supply0) -->
-	( { Iterations = 0 } ->
-		[]
-	;
-		{ Num1 = 20 },
-		{ get_random_numbers(Num1, [], List1, Supply0, Supply1) },
-		{ Num2 = 40 },
-		{ get_random_numbers(Num2, [], List2, Supply1, Supply) },
-		
-		{ Write = no },
-		run_test(Write, List1, List2),
-
-
-		run_tests(Iterations - 1, Supply)
-	).
-
-:- pred get_random_numbers(int::in, list(int)::in, list(int)::out,
-		random__supply::mdi, random__supply::muo) is det.
-
-get_random_numbers(Num, List0, List, Supply0, Supply) :-
-	( Num = 0 ->
-		List = List0,
-		Supply = Supply0
-	;
-		random__random(N, Supply0, Supply1),
-		RN = N rem 128 - 64,	% test negative numbers
-		get_random_numbers(Num - 1, [RN | List0], List,
-			Supply1, Supply)
-	).
-
-:- pred run_test(bool::in, list(int)::in, list(int)::in,
-		io__state::di, io__state::uo) is det.
-
-run_test(Write, List1, List2) -->
-	( { Write = yes } ->
-		io__write_string("List1: "),
-		io__write_list(list__sort(List1), ", ", io__write_int),
-		io__nl, io__nl,
-		io__write_string("List2: "),
-		io__write_list(list__sort(List2), ", ", io__write_int),
-		io__nl, io__nl
-	;
-		[]	
-	),
-	{ Set1 = bitset_tester__list_to_set(List1) },
-	{ Set2 = bitset_tester__list_to_set(List2) },
-
-	io__write_string("count: "),
-	io__write_int(count(Set1)),
-	io__write_string(" "),
-	io__write_int(count(Set2)),
-	io__nl,
-
-	io__write_string("testing foldl\n"),
-	{ Sum = (func(Elem, Acc) = Elem + Acc) },
-	{ Result1 = foldl(Sum, Set1, 0) },
-	{ Result2 = foldl(Sum, Set2, 0) },
-	( { Write = yes } ->
-		io__write_string("Sum of List1 = "),
-		io__write_int(Result1),
-		io__nl,
-		io__write_string("Sum of List2 = "),
-		io__write_int(Result2),
-		io__nl
-	;
-		[]
-	),
-
-	io__write_string("testing union\n"),
-	{ Union = union(Set1, Set2) },
-	write_bitset_result(Write, Union),
-
-	io__write_string("testing intersection\n"),
-	{ Intersection = intersect(Set1, Set2) },
-	write_bitset_result(Write, Intersection),
-
-	io__write_string("testing difference\n"),
-	{ Difference = difference(Set1, Set2) },
-	write_bitset_result(Write, Difference),
-
-	io__write_string("testing remove_least_element\n"),
-	( { remove_least(Set1, Least, RemovedLeast) } ->
-		( { Write = yes } ->
-			io__write_int(Least),
-			io__nl
-		;
-			[]
-		),
-		write_bitset_result(Write, RemovedLeast)
-	;
-		{ error("remove_least failed") }
-	),
-
-	io__write_string("testing delete_list\n"),
-	{ Delete = delete_list(Set1, List2) },
-	write_bitset_result(Write, Delete),
-
-	{ require(unify(delete_list(Set1, List1),
-			init `with_type` bitset_tester(int)),
-		"delete_list_failed") }.
-
-:- pred write_bitset_result(bool::in, bitset_tester(int)::in,
-		io__state::di, io__state::uo) is det.
-:- pragma no_inline(write_bitset_result/4).
-	
-write_bitset_result(Write, Set) -->
-	( { Write = yes } ->
-		{ List `with_type` list(int) = to_sorted_list(Set) },
-		io__write(List),
-		io__nl
-	;
-		[]
-	).
-
Index: write.exp2
===================================================================
RCS file: write.exp2
diff -N write.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ write.exp2	Wed Feb 14 02:51:32 2001
@@ -0,0 +1,48 @@
+var("X") + int(3) * var("X^2") ; (type)
+{ type }
+{ ':-' }
+':-'
+{ blah }
+blah ; (type), (type) * blah ; (type)
+((blah ; blah), blah) * blah ; blah
+(type) * blah ; (type)
+TESTING DISCRIMINATED UNIONS
+one
+two
+three
+apple([9, 5, 1])
+banana([three, one, two])
+zop(3.30000000000000, 2.03000000000000)
+zip(3, 2)
+zap(3, -2.11100000000000)
+wombat
+foo
+
+TESTING POLYMORPHISM
+poly_one([2399.30000000000])
+poly_two(3)
+poly_three(3.33000000000000, 4, poly_one(9.11000000000000))
+
+TESTING BUILTINS
+""
+"Hello, world\n"
+"Foo%sFoo"
+"\""
+'a'
+'&'
+3.14159000000000
+1.12832498300000e-021
+2.23954899000000e+023
+-65
+4
+univ_cons(["hi! I\'m a univ!"])
+'<<predicate>>'
+
+TESTING OTHER TYPES
+var(1)
+var_supply(0)
+var_supply(1)
+empty
+qwerty(4)
+array([1, 2, 3, 4])
+
Index: write_reg1.exp2
===================================================================
RCS file: write_reg1.exp2
diff -N write_reg1.exp2
--- /dev/null	Sat Aug  7 21:45:41 1999
+++ write_reg1.exp2	Wed Feb 14 02:51:32 2001
@@ -0,0 +1,39 @@
+TESTING DISCRIMINATED UNIONS
+one
+two
+three
+apple([9, 5, 1])
+banana([three, one, two])
+zop(3.30000000000000, 2.03000000000000)
+zip(3, 2)
+zap(3, -2.11100000000000)
+wombat
+foo
+
+TESTING POLYMORPHISM
+poly_one([2399.30000000000])
+poly_two(3)
+poly_three(3.33000000000000, 4, poly_one(9.11000000000000))
+
+TESTING BUILTINS
+""
+"Hello, world\n"
+"Foo%sFoo"
+"\""
+'a'
+'&'
+3.14159000000000
+1.12832498300000e-021
+2.23954899000000e+023
+-65
+4
+univ_cons(["hi! I\'m a univ!"])
+'<<predicate>>'
+
+TESTING OTHER TYPES
+var(1)
+var_supply(0)
+var_supply(1)
+empty
+qwerty(4)
+
Index: exceptions/test_exceptions_func.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/exceptions/test_exceptions_func.m,v
retrieving revision 1.1
diff -u -r1.1 test_exceptions_func.m
--- exceptions/test_exceptions_func.m	1999/08/31 12:57:20	1.1
+++ exceptions/test_exceptions_func.m	2001/02/13 15:51:32
@@ -20,7 +20,6 @@
 :- pred main(io__state::di, io__state::uo) is cc_multi.
 
 :- implementation.
-:- import_module std_util.
 :- import_module exception.
 
 main --> 
@@ -44,7 +43,6 @@
 
 :- pred semidet_throw(string::out) is semidet.
 semidet_throw(throw("semidet_throw")).
-
 
 :- pred det_succeed(string::out) is det.
 det_succeed("det_succeed").

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list