@@ -83,30 +83,30 @@ spec = do
83
83
84
84
context " when provided with a small program fragment" $ do
85
85
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
86
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_0.lq"
86
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_0.lq"
87
87
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
88
88
result `shouldSatisfy` (\ str -> " TypeUnit" `isInfixOf` str)
89
89
result `shouldSatisfy` (\ str -> " TermUnit" `isInfixOf` str)
90
90
91
91
context " when provided with a small program fragment" $ do
92
92
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
93
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_1.lq"
93
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_1.lq"
94
94
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
95
95
result `shouldSatisfy` (\ str -> " TypeBit" `isInfixOf` str)
96
96
result `shouldSatisfy` (\ str -> " TermBit" `isInfixOf` str)
97
97
result `shouldSatisfy` (\ str -> " BitValue 1" `isInfixOf` str)
98
98
99
99
context " when provided with a small program fragment" $ do
100
100
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
101
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_2.lq"
101
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_2.lq"
102
102
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
103
103
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
104
104
result `shouldSatisfy` (\ str -> " TermBit" `isInfixOf` str)
105
105
result `shouldSatisfy` (\ str -> " BitValue 1" `isInfixOf` str)
106
106
107
107
context " when provided with a small program fragment" $ do
108
108
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
109
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_3.lq"
109
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_3.lq"
110
110
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
111
111
result `shouldSatisfy` (\ str -> " TypeQbit" `isInfixOf` str)
112
112
result `shouldSatisfy` (\ str -> " TermApply" `isInfixOf` str)
@@ -115,7 +115,7 @@ spec = do
115
115
116
116
context " when provided with a small program fragment" $ do
117
117
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
118
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_4.lq"
118
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_4.lq"
119
119
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
120
120
result `shouldSatisfy` (\ str -> " TypeBit" `isInfixOf` str)
121
121
result `shouldSatisfy` (\ str -> " TermApply (TermMeasure (2,7)" `isInfixOf` str)
@@ -124,7 +124,7 @@ spec = do
124
124
125
125
context " when provided with a small program fragment" $ do
126
126
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
127
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_5.lq"
127
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_5.lq"
128
128
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
129
129
result `shouldSatisfy` (\ str -> " TypeNonLinear (TypeNonLinear TypeBit)" `isInfixOf` str)
130
130
result `shouldSatisfy` (\ str -> " TermApply (TermMeasure (2,7)" `isInfixOf` str)
@@ -133,7 +133,7 @@ spec = do
133
133
134
134
context " when provided with a small program fragment" $ do
135
135
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
136
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_6.lq"
136
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_6.lq"
137
137
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
138
138
result `shouldSatisfy` (\ str -> " TypeBit" `isInfixOf` str)
139
139
result `shouldSatisfy` (\ str -> " TermApply (TermMeasure (2,7)" `isInfixOf` str)
@@ -143,7 +143,7 @@ spec = do
143
143
144
144
context " when provided with a small program fragment" $ do
145
145
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
146
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_7.lq"
146
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_7.lq"
147
147
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
148
148
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
149
149
result `shouldSatisfy` (\ str -> " TermApply (TermMeasure (2,7)" `isInfixOf` str)
@@ -154,7 +154,7 @@ spec = do
154
154
-- TODO: fix
155
155
-- context "when provided with a small program fragment" $ do
156
156
-- it "returns a syntax tree processed in the intermediate syntax tree format" $ do
157
- -- result <- testProgramAndShowResults "test/programs/ast-conversion /program_fragment_8.lq"
157
+ -- result <- testProgramAndShowResults "test/programs/code-fragments /program_fragment_8.lq"
158
158
-- result `shouldSatisfy` (\str -> "Function fun (2,1)" `isInfixOf` str)
159
159
-- result `shouldSatisfy` (\str -> "TypeNonLinear TypeBit" `isInfixOf` str)
160
160
-- result `shouldSatisfy` (\str -> "TermApply (TermMeasure (2,7)" `isInfixOf` str)
@@ -164,7 +164,7 @@ spec = do
164
164
165
165
context " when provided with a small program fragment" $ do
166
166
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
167
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_9.lq"
167
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_9.lq"
168
168
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
169
169
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
170
170
result `shouldSatisfy` (\ str -> " TermLetMultiple" `isInfixOf` str)
@@ -173,7 +173,7 @@ spec = do
173
173
174
174
context " when provided with a small program fragment" $ do
175
175
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
176
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_10.lq"
176
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_10.lq"
177
177
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
178
178
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
179
179
result `shouldSatisfy` (\ str -> " TermLetMultiple" `isInfixOf` str)
@@ -183,17 +183,40 @@ spec = do
183
183
184
184
context " when provided with a small program fragment" $ do
185
185
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
186
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_11.lq"
186
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_11.lq"
187
187
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
188
188
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
189
189
result `shouldSatisfy` (\ str -> " TermLetSugarMultiple (TermTuple (TermApply (TermNew (2,18)) (TermBasisState BasisStateOne)) (TermApply (TermNew (2,26)) (TermBasisState BasisStateZero)))" `isInfixOf` str)
190
190
result `shouldSatisfy` (\ str -> " TermBit (BitValue 1)" `isInfixOf` str)
191
191
192
192
context " when provided with a small program fragment" $ do
193
193
it " returns a syntax tree processed in the intermediate syntax tree format" $ do
194
- result <- testProgramAndShowResults " test/programs/ast-conversion /program_fragment_12.lq"
194
+ result <- testProgramAndShowResults " test/programs/code-fragments /program_fragment_12.lq"
195
195
result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
196
196
result `shouldSatisfy` (\ str -> " TypeNonLinear TypeBit" `isInfixOf` str)
197
197
result `shouldSatisfy` (\ str -> " TermLetSugarMultiple (TermTuple (TermApply (TermNew (2,18)) (TermBasisState BasisStateOne)) (TermApply (TermNew (2,26)) (TermBasisState BasisStateZero)))" `isInfixOf` str)
198
198
result `shouldSatisfy` (\ str -> " TermVariable (Var ((3,38),gate))" `isInfixOf` str)
199
- result `shouldSatisfy` (\ str -> " (TermGate GateX)) (TermVariable (Var ((3,45),q2)))" `isInfixOf` str)
199
+ result `shouldSatisfy` (\ str -> " (TermGate GateX)) (TermVariable (Var ((3,45),q2)))" `isInfixOf` str)
200
+
201
+ context " when provided with a small program fragment" $ do
202
+ it " returns a syntax tree processed in the intermediate syntax tree format" $ do
203
+ result <- testProgramAndShowResults " test/programs/code-fragments/program_fragment_13.lq"
204
+ result `shouldSatisfy` (\ str -> " Function fun (2,1) TypeBit" `isInfixOf` str)
205
+ result `shouldSatisfy` (\ str -> " TermTuple (TermApply (TermNew (2,27)) (TermBasisState BasisStateOne)) (TermTuple (TermApply (TermNew (2,35)) (TermBasisState BasisStateZero)) (TermApply (TermNew (2,43)) (TermBasisState BasisStateOne))" `isInfixOf` str)
206
+ result `shouldSatisfy` (\ str -> " TermQuantumCtrlsGate TermVariable (Var ((3,22),q1)),TermVariable (Var ((3,28),q2)) BasisStateOne,BasisStatePlusI)" `isInfixOf` str)
207
+ result `shouldSatisfy` (\ str -> " (TermGate GateX)) (TermVariable (Var ((3,58),q3)))" `isInfixOf` str)
208
+
209
+ context " when provided with a small program fragment" $ do
210
+ it " returns a syntax tree processed in the intermediate syntax tree format" $ do
211
+ result <- testProgramAndShowResults " test/programs/code-fragments/program_fragment_14.lq"
212
+ result `shouldSatisfy` (\ str -> " Function fun (2,1) TypeBit" `isInfixOf` str)
213
+ result `shouldSatisfy` (\ str -> " (TermLetSugarMultiple (TermTuple (TermApply (TermNew (2,26)) (TermBasisState BasisStateZero)) (TermTuple (TermApply (TermNew (2,34)) (TermBasisState BasisStateZero)) (TermTuple (TermApply (TermNew (2,42)) (TermBasisState BasisStateZero)) (TermApply (TermNew (2,50)) (TermBasisState BasisStateZero)))))" `isInfixOf` str)
214
+ result `shouldSatisfy` (\ str -> " TermQuantumCtrlsGate TermVariable (Var ((3,22),q1)),TermVariable (Var ((3,28),q3)),TermVariable (Var ((3,34),q4)) BasisStateOne,BasisStateOne,BasisStateOne)" `isInfixOf` str)
215
+ result `shouldSatisfy` (\ str -> " (TermGate GateY)) (TermVariable (Var ((3,67),q2)))" `isInfixOf` str)
216
+
217
+ context " when provided with a small program fragment" $ do
218
+ it " returns a syntax tree processed in the intermediate syntax tree format" $ do
219
+ result <- testProgramAndShowResults " test/programs/code-fragments/program_fragment_15.lq"
220
+ result `shouldSatisfy` (\ str -> " Function fun (2,1)" `isInfixOf` str)
221
+ result `shouldSatisfy` (\ str -> " TypeQbit" `isInfixOf` str)
222
+ result `shouldSatisfy` (\ str -> " TermApply (TermNew (2,7)) (TermBasisState BasisStateZero)" `isInfixOf` str)
0 commit comments