diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-26 15:35:46 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-26 16:53:23 -0700 |
| commit | d62229e3ad6069597b74874ba3b84fc185b2fa4c (patch) | |
| tree | f2618b8263edb55fd0fd4c6cebaa9890b4b5838d /test/behavior/floatop.zig | |
| parent | 822d29286bd39b7331970e1e641ad240e7b62aee (diff) | |
| download | zig-d62229e3ad6069597b74874ba3b84fc185b2fa4c.tar.gz zig-d62229e3ad6069597b74874ba3b84fc185b2fa4c.zip | |
Sema: Module.Union.abiAlignment can return 0
When the union is a 0-bit type.
Diffstat (limited to 'test/behavior/floatop.zig')
| -rw-r--r-- | test/behavior/floatop.zig | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index 85d5cec1e6..5597be122e 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -155,15 +155,14 @@ test "@sin" { fn testSin() !void { // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` - // so skip the rest of the tests. - if (builtin.zig_backend != .stage1) { - inline for ([_]type{ f16, f32, f64 }) |ty| { - const eps = epsForType(ty); - try expect(@sin(@as(ty, 0)) == 0); - try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi)), 0, eps)); - try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 2)), 1, eps)); - try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); - } + if (builtin.zig_backend == .stage1) return error.SkipZigTest; + + inline for ([_]type{ f16, f32, f64 }) |ty| { + const eps = epsForType(ty); + try expect(@sin(@as(ty, 0)) == 0); + try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi)), 0, eps)); + try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 2)), 1, eps)); + try expect(math.approxEqAbs(ty, @sin(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); } { @@ -183,15 +182,14 @@ test "@cos" { fn testCos() !void { // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` - // so skip the rest of the tests. - if (builtin.zig_backend != .stage1) { - inline for ([_]type{ f16, f32, f64 }) |ty| { - const eps = epsForType(ty); - try expect(@cos(@as(ty, 0)) == 1); - try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi)), -1, eps)); - try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 2)), 0, eps)); - try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); - } + if (builtin.zig_backend == .stage1) return error.SkipZigTest; + + inline for ([_]type{ f16, f32, f64 }) |ty| { + const eps = epsForType(ty); + try expect(@cos(@as(ty, 0)) == 1); + try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi)), -1, eps)); + try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 2)), 0, eps)); + try expect(math.approxEqAbs(ty, @cos(@as(ty, std.math.pi / 4)), 0.7071067811865475, eps)); } { |
