| ... | ... | @@ -4,6 +4,7 @@ const expectEqual = std.testing.expectEqual; |
| 4 | 4 | const expectEqualSlices = std.testing.expectEqualSlices; |
| 5 | 5 | const maxInt = std.math.maxInt; |
| 6 | 6 | const minInt = std.math.minInt; |
| 7 | const mem = std.mem; |
| 7 | 8 | |
| 8 | 9 | test "division" { |
| 9 | 10 | if (@import("builtin").arch == .riscv64) { |
| ... | ... | @@ -653,3 +654,20 @@ test "128-bit multiplication" { |
| 653 | 654 | var c = a * b; |
| 654 | 655 | expect(c == 6); |
| 655 | 656 | } |
| 657 | |
| 658 | test "vector comparison" { |
| 659 | const S = struct { |
| 660 | fn doTheTest() void { |
| 661 | var a: @Vector(6, i32) = [_]i32{1, 3, -1, 5, 7, 9}; |
| 662 | var b: @Vector(6, i32) = [_]i32{-1, 3, 0, 6, 10, -10}; |
| 663 | expect(mem.eql(bool, &@as([6]bool, a < b), &[_]bool{false, false, true, true, true, false})); |
| 664 | expect(mem.eql(bool, &@as([6]bool, a <= b), &[_]bool{false, true, true, true, true, false})); |
| 665 | expect(mem.eql(bool, &@as([6]bool, a == b), &[_]bool{false, true, false, false, false, false})); |
| 666 | expect(mem.eql(bool, &@as([6]bool, a != b), &[_]bool{true, false, true, true, true, true})); |
| 667 | expect(mem.eql(bool, &@as([6]bool, a > b), &[_]bool{true, false, false, false, false, true})); |
| 668 | expect(mem.eql(bool, &@as([6]bool, a >= b), &[_]bool{true, true, false, false, false, true})); |
| 669 | } |
| 670 | }; |
| 671 | S.doTheTest(); |
| 672 | comptime S.doTheTest(); |
| 673 | } |