Skip to content

Commit

Permalink
add more functiondef tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Jul 9, 2024
1 parent c04f9fd commit 828c12a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/qlassf/test_functiondef.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,30 @@ def test_pass_multi_stmt_function(self):
compute_and_compare_results(self, qf)
compute_and_compare_results(self, qg, test_original_f=False)

def test_inner_function(self):
def test_inner_function1(self):
f = """def test(a: bool) -> bool:
def test2(b:bool) -> bool:
return not b
return test2(a)"""
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

def test_inner_function2(self):
f = """def test(a: bool, z: bool) -> bool:
def test2(b:bool) -> bool:
return not b
def test3(b:bool, c:bool) -> bool:
return b and c
return test3(test2(a), z)"""
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

def test_inner_function3(self):
f = """def test(a: bool) -> bool:
def test2(b:bool) -> bool:
def test3(b:bool) -> bool:
return not b
return not test3(b)
return test2(a)"""
qf = qlassf(f, to_compile=COMPILATION_ENABLED, compiler=self.compiler)
compute_and_compare_results(self, qf)

0 comments on commit 828c12a

Please sign in to comment.