Skip to content

Commit

Permalink
test assignment to a boolean operation
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
esc committed Jan 30, 2025
1 parent b5bb5a9 commit ba4e132
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions numba_rvsdg/tests/test_ast_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,45 @@ def function(x: int, y: int) -> int:
],
)

def test_bool_op_assignment(self):
def function(x: int, y: int) -> bool:
result = x and y
return result

expected = {
"0": {
"instructions": [
"__scfg_bool_op_1__ = x",
"__scfg_bool_op_1__",
],
"jump_targets": ["1", "2"],
"name": "0",
},
"1": {
"instructions": ["__scfg_bool_op_1__ = y"],
"jump_targets": ["2"],
"name": "1",
},
"2": {
"instructions": [
"result = __scfg_bool_op_1__",
"return result",
],
"jump_targets": [],
"name": "2",
},
}
self.compare(
function,
expected,
arguments=[
(0, 0), # Both false
(0, 1), # x false, y true
(1, 0), # x true, y false
(1, 1), # Both true
],
)


class TestEntryPoints(TestCase):

Expand Down

0 comments on commit ba4e132

Please sign in to comment.