Skip to content

Commit 7cbf78f

Browse files
committed
[tests] Add test for import statement
Signed-off-by: Manas <manas18244@iiitd.ac.in>
1 parent 4ef4793 commit 7cbf78f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/test_import.ql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
import complex_expr_lib::sin;
3+
4+
fn main() : f64 {
5+
let x = 2;
6+
return sin(x);
7+
}

tests/tests.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,24 @@ fn test_ast_gen() -> Result<(), Box<dyn std::error::Error>> {
348348
|_ (n: float64 * factorial$factorial: float64 ((n: float64 - 1)))
349349
350350
351+
");
352+
353+
test!("tests/test_import.ql",
354+
"|_ complex_expr_lib // @complex_expr_lib.ql:1:1
355+
|_ fn complex_expr_lib$bar () : qubit // @complex_expr_lib.ql:2:4
356+
|_ 0q1_0
357+
358+
|_ fn complex_expr_lib$sin (r: float64) : float64 // @complex_expr_lib.ql:6:4
359+
|_ (r: float64 / 180)
360+
361+
|_ fn complex_expr_lib$cos (r: float64) : float64 // @complex_expr_lib.ql:10:4
362+
|_ (r: float64 / 90)
363+
364+
|_ test_import // @test_import.ql:1:1
365+
|_ fn test_import$main () : float64 // @test_import.ql:4:4
366+
|_ x: float64 = 2
367+
|_ complex_expr_lib$sin: float64 (x: float64)
368+
351369
");
352370

353371
test!("examples/toss.ql",

0 commit comments

Comments
 (0)