Commit e5507148 authored by dcw's avatar dcw
Browse files

Initial revision

parent d1901610
MODULE mtest;
(* Test of various automatically generated datatypes *)
FROM BIO IMPORT PutString, PutLine, PutLn;
FROM FIO IMPORT StdOut;
FROM mx IMPORT
string, intlist, intlist_null, intlist_cons,
getkind_intlist, get_intlist_cons, print_intlist,
illist, illist_null, illist_cons, getkind_illist,
get_illist_cons, print_illist,
idtree, idtree_leaf, idtree_node, getkind_idtree,
get_idtree_leaf, get_idtree_node, print_idtree;
VAR
int1, int2, int3 : intlist;
PROCEDURE test_intlist();
BEGIN
int1 := intlist_null();
int2 := intlist_cons( 10, int1 );
int3 := intlist_cons( 20, int2 );
PutLn( "intlists:" );
PutLine();
PutString( " int1: " ); print_intlist( StdOut, int1 ); PutLine();
PutString( " int2: " ); print_intlist( StdOut, int2 ); PutLine();
PutString( " int3: " ); print_intlist( StdOut, int3 ); PutLine();
PutLine();
END test_intlist;
PROCEDURE test_illist();
VAR
il1, il2, il3, il4 : illist;
BEGIN
il1 := illist_null();
il2 := illist_cons( int1, il1 );
il3 := illist_cons( int2, il2 );
il4 := illist_cons( int3, il3 );
PutLn( "illists:" );
PutLine();
PutString( " il1: " ); print_illist( StdOut, il1 ); PutLine();
PutString( " il2: " ); print_illist( StdOut, il2 ); PutLine();
PutString( " il3: " ); print_illist( StdOut, il3 ); PutLine();
PutString( " il4: " ); print_illist( StdOut, il4 ); PutLine();
PutLine();
END test_illist;
PROCEDURE test_idtree();
VAR
id1, id2, id3, id4, id5, id6 : idtree;
BEGIN
id1 := idtree_leaf( "hello", int1 );
id2 := idtree_leaf( "there", int2 );
id3 := idtree_node( id1, id2 );
id4 := idtree_node( id3, id1 );
id5 := idtree_leaf( "zebedee", int3 );
id6 := idtree_node( id4, id5 );
PutLn( "idtrees:" );
PutLine();
PutString( " id1: " ); print_idtree( StdOut, id1 ); PutLine();
PutString( " id2: " ); print_idtree( StdOut, id2 ); PutLine();
PutString( " id3: " ); print_idtree( StdOut, id3 ); PutLine();
PutString( " id4: " ); print_idtree( StdOut, id4 ); PutLine();
PutString( " id5: " ); print_idtree( StdOut, id5 ); PutLine();
PutString( " id6: " ); print_idtree( StdOut, id6 ); PutLine();
PutLine();
END test_idtree;
PROCEDURE gc( ) : CHAR;
VAR ch : CHAR;
BEGIN
GetChar( ch );
RETURN ch;
END gc;
BEGIN
test_intlist();
test_illist();
test_idtree();
END mtest.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment