From 1adca155dda03a2f915bc88539a9310659189254 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 20 Jan 2009 23:43:42 +0000 Subject: [PATCH] Added a file full of tests for inferring direction specifiers in PROC formals --- frontends/OccamTypesTest.hs | 1 + testcases/automatic/chan-ends.occ.test | 85 ++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 testcases/automatic/chan-ends.occ.test diff --git a/frontends/OccamTypesTest.hs b/frontends/OccamTypesTest.hs index ebd42bf..033ff9c 100644 --- a/frontends/OccamTypesTest.hs +++ b/frontends/OccamTypesTest.hs @@ -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" ] diff --git a/testcases/automatic/chan-ends.occ.test b/testcases/automatic/chan-ends.occ.test new file mode 100644 index 0000000..7902f51 --- /dev/null +++ b/testcases/automatic/chan-ends.occ.test @@ -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!) + + +%