github.com/aykevl/tinygo@v0.5.0/testdata/binop.go (about) 1 package main 2 3 func main() { 4 println("string equality") 5 println(a == "a") 6 println(a == "b") 7 println(a != "a") 8 println(a != "b") 9 println("string inequality") 10 println(a > "b") 11 println("b" > a) 12 println("b" > "b") 13 println(a <= "b") 14 println("b" <= a) 15 println("b" <= "b") 16 println(a > "b") 17 println("b" > a) 18 println("b" > "b") 19 println(a <= "b") 20 println("b" <= a) 21 println("b" <= "b") 22 println(a < "aa") 23 println("aa" < a) 24 println("ab" < "aa") 25 println("aa" < "ab") 26 27 println("array equality") 28 println(a1 == [2]int{1, 2}) 29 println(a1 != [2]int{1, 2}) 30 println(a1 == [2]int{1, 3}) 31 println(a1 == [2]int{2, 2}) 32 println(a1 == [2]int{2, 1}) 33 println(a1 != [2]int{2, 1}) 34 35 println("struct equality") 36 println(s1 == Struct1{3, true}) 37 println(s1 == Struct1{4, true}) 38 println(s1 == Struct1{3, false}) 39 println(s1 == Struct1{4, false}) 40 println(s1 != Struct1{3, true}) 41 println(s1 != Struct1{4, true}) 42 println(s1 != Struct1{3, false}) 43 println(s1 != Struct1{4, false}) 44 45 println("blank fields in structs") 46 println(s2 == Struct2{"foo", 0.0, 5}) 47 println(s2 == Struct2{"foo", 0.0, 7}) 48 println(s2 == Struct2{"foo", 1.0, 5}) 49 println(s2 == Struct2{"foo", 1.0, 7}) 50 51 println("complex numbers") 52 println(c64 == 3+2i) 53 println(c64 == 4+2i) 54 println(c64 == 3+3i) 55 println(c64 != 3+2i) 56 println(c64 != 4+2i) 57 println(c64 != 3+3i) 58 println(c128 == 3+2i) 59 println(c128 == 4+2i) 60 println(c128 == 3+3i) 61 println(c128 != 3+2i) 62 println(c128 != 4+2i) 63 println(c128 != 3+3i) 64 } 65 66 var x = true 67 var y = false 68 69 var a = "a" 70 var s1 = Struct1{3, true} 71 var s2 = Struct2{"foo", 0.0, 5} 72 73 var a1 = [2]int{1, 2} 74 75 var c64 = 3 + 2i 76 var c128 = 4 + 3i 77 78 type Int int 79 80 type Struct1 struct { 81 i Int 82 b bool 83 } 84 85 type Struct2 struct { 86 s string 87 _ float64 88 i int 89 }