home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
lifeos2.zip
/
LIFE-1.02
/
TESTS
/
LF
/
SUBSORT.LF
< prev
next >
Wrap
Text File
|
1996-06-04
|
1KB
|
64 lines
% test out the subsort(A,B) predicate which returns true if A :=< B and
% residuates on B, else it returns false.
wln(A) :- write(A), nl.
wless(A,B) :- write(A, " :<= ", B), nl.
testnum(A) :- subsort(A, B), wless(A,B),
B = real, wless(A,B), gc,
B = int, wless(A,B),
B = 1, wless(A,B).
testreal(A) :- subsort(A, B), wless(A,B),
B = real, wless(A,B), gc,
B = 3.2, wless(A,B),
B = int, wless(A,B),
B = 1, wless(A,B).
allChildren(X) -> A | genChildren(children(X), A).
genChildren([H|T], H).
genChildren([X|T], Y) :- genChildren(T, Y).
seqFile <| file.
randFile <| file.
readFile <| file.
writeFile <| file.
seqWriteFile <| seqFile.
seqWriteFile <| writeFile.
seqReadFile <| seqFile.
seqReadFile <| readFile.
randReadFile <| readFile.
randReadFile <| randFile.
terminal <| seqWriteFile.
terminal <| readFile.
testFile(A,B) :- subsort(A, B),
wless(A,B),
wln("stage one"), gc,
B = allChildren(B), wless(A,B),
wln("stage two"),
B = allChildren(B), wless(A,B),
wln("stage three"), gc,
B = allChildren(B), wless(A,B),
wln("***********"),
fail.
%testnum(2)?
%testnum(int)?
%testnum(3.2)?
%
%testreal(string)?
%testreal(1)?
%testreal(4.0)?
%
%testFile(terminal, file)?
%testFile(seqFile, file)?
%
%testFile(mouse_event, event)?