| ... | @@ -15,3 +15,17 @@ test "vector wrap operators" { | ... | @@ -15,3 +15,17 @@ test "vector wrap operators" { |
| 15 | S.doTheTest(); | 15 | S.doTheTest(); |
| 16 | comptime S.doTheTest(); | 16 | comptime S.doTheTest(); |
| 17 | } | 17 | } |
| | 18 | |
| | 19 | test "vector float operators" { |
| | 20 | const S = struct { |
| | 21 | fn doTheTest() void { |
| | 22 | const v: @Vector(4, f32) = [4]f32{ 10, 20, 30, 40 }; |
| | 23 | const x: @Vector(4, f32) = [4]f32{ 1, 2, 3, 4 }; |
| | 24 | expect(mem.eql(f32, ([4]f32)(v + x), [4]f32{ 11, 22, 33, 44 })); |
| | 25 | expect(mem.eql(f32, ([4]f32)(v - x), [4]f32{ 9, 18, 27, 36 })); |
| | 26 | expect(mem.eql(f32, ([4]f32)(v * x), [4]f32{ 10, 40, 90, 160 })); |
| | 27 | } |
| | 28 | }; |
| | 29 | S.doTheTest(); |
| | 30 | comptime S.doTheTest(); |
| | 31 | } |