Added a file full of tests for inferring direction specifiers in PROC formals

This commit is contained in:
Neil Brown 2009-01-20 23:43:42 +00:00
parent d806931fbf
commit 1adca155dd
2 changed files with 86 additions and 0 deletions

View File

@ -646,4 +646,5 @@ ioTests = liftM (TestLabel "OccamTypesTest" . TestList) $ sequence $
, "testcases/automatic/direction-decorators-3.occ.test"
, "testcases/automatic/initial-result-1.occ.test"
, "testcases/automatic/initial-result-2.occ.test"
, "testcases/automatic/chan-ends.occ.test"
]

View File

@ -0,0 +1,85 @@
-- This file tests the inferring of output direction specifiers for PROCs
PROC foo(CHAN INT c)
%%
:
PROC main()
CHAN INT c:
%%M
:
%PASS Skip body
SKIP
%M
foo(c)
%FAIL Skip body, with input direction
SKIP
%M
foo(c?)
%FAIL Skip body, with output direction
SKIP
%M
foo(c!)
%PASS Output body, with no direction
c ! 3
%M
foo(c)
%FAIL Output body, with input direction
c ! 3
%M
foo(c?)
%PASS Output body, with output direction
c ! 3
%M
foo(c!)
%PASS Input body, with no direction
INT x:
c ? x
%M
foo(c)
%PASS Input body, with input direction
INT x:
c ? x
%M
foo(c?)
%FAIL Input body, with output direction
INT x:
c ? x
%M
foo(c!)
%PASS Input and output body, with no direction
SEQ
c ! 3
INT x:
c ? x
%M
foo(c)
%FAIL Input and output body, with input direction
SEQ
c ! 3
INT x:
c ? x
%M
foo(c?)
%FAIL Input and output body, with output direction
SEQ
c ! 3
INT x:
c ? x
%M
foo(c!)
%