From 536d0b19a69499c263c0c6adbc9f11ed6f1e972a Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 17 Jan 2009 22:20:52 +0000 Subject: [PATCH] Fixed all the failing C++CSP tests for input and output so that they now pass --- backends/GenerateCTest.hs | 85 ++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 24 deletions(-) diff --git a/backends/GenerateCTest.hs b/backends/GenerateCTest.hs index 74e0ed2..74a7b33 100644 --- a/backends/GenerateCTest.hs +++ b/backends/GenerateCTest.hs @@ -941,18 +941,28 @@ testInput = TestList ,testBothSame "testInput 2" "^^^" (overInputItemCase (tcall2 genInput undefined $ A.InputSimple undefined [undefined, undefined, undefined])) -- Reading an integer (special case in the C backend): - ,testInputItem 100 "ChanInInt(wptr,#,&x);" "#>>x;" (A.InVariable emptyMeta $ variable "x") A.Int + ,testInputItem 100 "ChanInInt(wptr,#,&x);" "tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(Int),&x));" + (A.InVariable emptyMeta $ variable "x") A.Int -- Reading a other plain types: - ,testInputItem 101 "ChanIn(wptr,#,&x,^(Int8));" "#>>x;" (A.InVariable emptyMeta $ variable "x") A.Int8 - ,testInputItem 102 ("ChanIn(wptr,#,(&x),^(" ++ show (A.Record foo) ++ "));") "#>>*(&x);" (A.InVariable emptyMeta $ variable "x") (A.Record foo) + ,testInputItem 101 "ChanIn(wptr,#,&x,^(Int8));" "tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(Int8),&x));" + (A.InVariable emptyMeta $ variable "x") A.Int8 + ,testInputItem 102 ("ChanIn(wptr,#,(&x),^(" ++ show (A.Record foo) ++ "));") + ("tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(" ++ show (A.Record foo) ++ "),(&x)));") + (A.InVariable emptyMeta $ variable "x") (A.Record foo) -- Reading into a fixed size array: - ,testInputItem 103 "ChanIn(wptr,#,x,^(Array [Dimension 8] Int));" "tockRecvArray(#,x);" (A.InVariable emptyMeta $ variable "x") $ A.Array [dimension 8] A.Int + ,testInputItem 103 "ChanIn(wptr,#,x,^(Array [Dimension 8] Int));" + "tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(Array [Dimension 8] Int),x));" + (A.InVariable emptyMeta $ variable "x") $ A.Array [dimension 8] A.Int -- Reading into subscripted variables: - ,testInputItem 110 "ChanInInt(wptr,#,&xs$);" "#>>xs$;" (A.InVariable emptyMeta $ sub0 $ variable "xs") A.Int + ,testInputItem 110 "ChanInInt(wptr,#,&xs$);" "tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(Int),&xs$));" + (A.InVariable emptyMeta $ sub0 $ variable "xs") A.Int -- Reading a other plain types: - ,testInputItem 111 "ChanIn(wptr,#,&xs$,^(Int8));" "#>>xs$;" (A.InVariable emptyMeta $ sub0 $ variable "xs") A.Int8 - ,testInputItem 112 ("ChanIn(wptr,#,(&xs$),^(" ++ show (A.Record foo) ++ "));") "#>>*(&xs$);" (A.InVariable emptyMeta $ sub0 $ variable "xs") (A.Record foo) + ,testInputItem 111 "ChanIn(wptr,#,&xs$,^(Int8));" "tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(Int8),&xs$));" + (A.InVariable emptyMeta $ sub0 $ variable "xs") A.Int8 + ,testInputItem 112 ("ChanIn(wptr,#,(&xs$),^(" ++ show (A.Record foo) ++ "));") + ("tockRecvArrayOfBytes(#,tockSendableArrayOfBytes(^(" ++ show (A.Record foo) ++ "),(&xs$)));") + (A.InVariable emptyMeta $ sub0 $ variable "xs") (A.Record foo) -- A counted array of Int: ,testInputItem 200 "ChanInInt(wptr,#,&x);ChanIn(wptr,#,xs,x*^(Int));" @@ -1034,42 +1044,69 @@ testOutput = TestList ,testBothS "testOutput 101" "ChanOutInt(wptr,cOut,bar_foo);^" "tockSendInt(cOut,bar_foo);^" (overOutput (tcall3 genOutputCase (A.Variable emptyMeta chanOut) bar [])) state --Integers are a special case in the C backend: - ,testOutputItem 201 "ChanOutInt(wptr,#,x);" "#<