forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lcompilers#1506 from Smit-create/i-1487
LLVM: Support logical binop for strings, int, real
- Loading branch information
Showing
3 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from ltypes import i32 | ||
|
||
def test_issue_1487_1(): | ||
a : i32 | ||
b : i32 | ||
x : i32 | ||
y : i32 | ||
or_op1 : i32 | ||
or_op2 : i32 | ||
a = 1 | ||
b = 2 | ||
x = 0 | ||
y = 4 | ||
or_op1 = a or b | ||
or_op2 = x or y | ||
assert or_op1 == 1 | ||
assert or_op2 == 4 | ||
y = 0 | ||
or_op2 = x or y | ||
assert or_op2 == 0 | ||
|
||
|
||
def test_issue_1487_2(): | ||
a : i32 | ||
b : i32 | ||
x : i32 | ||
y : i32 | ||
and_op1 : i32 | ||
and_op2 : i32 | ||
a = 100 | ||
b = 150 | ||
x = 175 | ||
y = 0 | ||
and_op1 = a and b | ||
and_op2 = y and x | ||
assert and_op1 == 150 | ||
assert and_op2 == 0 | ||
x = 0 | ||
and_op2 = y and x | ||
and_op1 = b and a | ||
assert and_op2 == 0 | ||
assert and_op1 == 100 | ||
|
||
|
||
def check(): | ||
test_issue_1487_1() | ||
test_issue_1487_2() | ||
|
||
|
||
check() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters