diff: io__write test case

Fergus Henderson fjh at cs.mu.oz.au
Tue Apr 29 03:20:09 AEST 1997


Hi Zoltan,

Here is the test case for the change to io__write that I just mailed.

tests/hard_coded/write.m:
	Add some code to test output of terms involving operators.

Index: write.m
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/write.m,v
retrieving revision 1.1
diff -u -r1.1 write.m
--- write.m	1996/12/18 01:00:17	1.1
+++ write.m	1997/04/28 17:18:45
@@ -12,6 +12,7 @@
 
 :- import_module list, int, std_util, term, map.
 
+:- pred test_ops(io__state::di, io__state::uo) is det.
 :- pred test_builtins(io__state::di, io__state::uo) is det.
 :- pred test_discriminated(io__state::di, io__state::uo) is det.
 :- pred test_polymorphism(io__state::di, io__state::uo) is det.
@@ -34,12 +35,35 @@
 
 :- type no_tag		---> 	qwerty(int).
 
+:- type expr		--->	var(string)
+			;	int(int)
+			;	expr + expr
+			;	expr - expr
+			; 	expr * expr
+			;	(expr, expr)
+			;	{expr; expr}
+			;	{{expr}}
+			;	(type)
+			;	blah
+			;	(:-)
+			.
+
 main -->
+	test_ops,
 	test_discriminated,
 	test_polymorphism,
 	test_builtins, 
 	test_other.
 
+
+test_ops -->
+	io__write(var("X") + int(3) * var("X^2") ; (type)), newline,
+	io__write({type}), newline,
+	io__write({:-}), newline,
+	io__write({blah}), newline,
+	io__write((blah ; (type), (type) * blah ; (type))), newline,
+	io__write(((blah ; blah), blah) * blah ; blah), newline,
+	io__write((type) * blah ; (type)), newline.
 
 test_discriminated -->
 	io__write_string("TESTING DISCRIMINATED UNIONS\n"),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list