Add test case for comparisons on defined types

This commit is contained in:
Sasha Koshka 2024-01-28 02:18:18 -05:00
parent f595a2e742
commit 7e4abb7bba

View File

@ -72,7 +72,8 @@ testString (test,
func TestCompare (test *testing.T) { func TestCompare (test *testing.T) {
testString (test, testString (test,
`%Bool = type i8 `%Bool = type i8
define %Bool @main() { %A = type i64
define void @main() {
0: 0:
%1 = alloca i64 %1 = alloca i64
store i64 32, ptr %1 store i64 32, ptr %1
@ -86,15 +87,20 @@ define %Bool @main() {
store i1 %7, ptr %2 store i1 %7, ptr %2
%8 = load i64, ptr %1 %8 = load i64, ptr %1
%9 = icmp eq i64 32, %8 %9 = icmp eq i64 32, %8
ret i1 %9 store i1 %9, ptr %2
%10 = icmp sgt i64 5, 3
store i1 %10, ptr %2
ret void
} }
`, `,
` `
[main]:Bool = { A: Int
[main] = {
x:Int = 32 x:Int = 32
b:Bool = [> x 1] b:Bool = [> x 1]
b = [< 0 x 50] b = [< 0 x 50]
[= 32 x] b = [= 32 x]
b = [> [~A 5] [~A 3]]
} }
`) `)
} }