| author | |
| committer | |
| log | 9f0fd72321bf04654042a2191274cb31ba8f9110 |
| tree | 72f189f0ba138af58921a7f8a0849e65ae620632 |
| parent | 3fb301b16a51504bea1aa89efe856a2c2df6f293 |
move it from bugs/xxx.zig to its own category3 files changed, 43 insertions(+), 36 deletions(-)
test/behavior.zig+1-1| ... | ... | @@ -189,6 +189,7 @@ test { |
| 189 | 189 | _ = @import("behavior/merge_error_sets.zig"); |
| 190 | 190 | _ = @import("behavior/muladd.zig"); |
| 191 | 191 | _ = @import("behavior/namespace_depends_on_compile_var.zig"); |
| 192 | _ = @import("behavior/nan.zig"); | |
| 192 | 193 | _ = @import("behavior/null.zig"); |
| 193 | 194 | _ = @import("behavior/optional.zig"); |
| 194 | 195 | _ = @import("behavior/packed-struct.zig"); |
| ... | ... | @@ -253,7 +254,6 @@ test { |
| 253 | 254 | builtin.zig_backend != .stage2_c and |
| 254 | 255 | builtin.zig_backend != .stage2_spirv64) |
| 255 | 256 | { |
| 256 | _ = @import("behavior/bugs/14198.zig"); | |
| 257 | 257 | _ = @import("behavior/export.zig"); |
| 258 | 258 | } |
| 259 | 259 | } |
test/behavior/bugs/14198.zig deleted-35| ... | ... | @@ -1,35 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const math = std.math; | |
| 3 | const mem = std.mem; | |
| 4 | const testing = std.testing; | |
| 5 | ||
| 6 | const qnan_u16: u16 = 0x7E00; | |
| 7 | const snan_u16: u16 = 0x7D00; | |
| 8 | const qnan_u32: u32 = 0x7FC00000; | |
| 9 | const snan_u32: u32 = 0x7FA00000; | |
| 10 | const qnan_u64: u64 = 0x7FF8000000000000; | |
| 11 | const snan_u64: u64 = 0x7FF4000000000000; | |
| 12 | const qnan_u128: u128 = 0x7FFF8000000000000000000000000000; | |
| 13 | const snan_u128: u128 = 0x7FFF4000000000000000000000000000; | |
| 14 | const qnan_f16: f16 = math.nan(f16); | |
| 15 | const snan_f16: f16 = math.snan(f16); | |
| 16 | const qnan_f32: f32 = math.nan(f32); | |
| 17 | const snan_f32: f32 = math.snan(f32); | |
| 18 | const qnan_f64: f64 = math.nan(f64); | |
| 19 | const snan_f64: f64 = math.snan(f64); | |
| 20 | const qnan_f128: f128 = math.nan(f128); | |
| 21 | const snan_f128: f128 = math.snan(f128); | |
| 22 | ||
| 23 | test "nan memory equality" { | |
| 24 | // signaled | |
| 25 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u16), mem.asBytes(&snan_f16))); | |
| 26 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u32), mem.asBytes(&snan_f32))); | |
| 27 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u64), mem.asBytes(&snan_f64))); | |
| 28 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u128), mem.asBytes(&snan_f128))); | |
| 29 | ||
| 30 | // quiet | |
| 31 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u16), mem.asBytes(&qnan_f16))); | |
| 32 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u32), mem.asBytes(&qnan_f32))); | |
| 33 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u64), mem.asBytes(&qnan_f64))); | |
| 34 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u128), mem.asBytes(&qnan_f128))); | |
| 35 | } |
test/behavior/nan.zig created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const std = @import("std"); | |
| 3 | const math = std.math; | |
| 4 | const mem = std.mem; | |
| 5 | const testing = std.testing; | |
| 6 | ||
| 7 | const qnan_u16: u16 = 0x7E00; | |
| 8 | const snan_u16: u16 = 0x7D00; | |
| 9 | const qnan_u32: u32 = 0x7FC00000; | |
| 10 | const snan_u32: u32 = 0x7FA00000; | |
| 11 | const qnan_u64: u64 = 0x7FF8000000000000; | |
| 12 | const snan_u64: u64 = 0x7FF4000000000000; | |
| 13 | const qnan_u128: u128 = 0x7FFF8000000000000000000000000000; | |
| 14 | const snan_u128: u128 = 0x7FFF4000000000000000000000000000; | |
| 15 | const qnan_f16: f16 = math.nan(f16); | |
| 16 | const snan_f16: f16 = math.snan(f16); | |
| 17 | const qnan_f32: f32 = math.nan(f32); | |
| 18 | const snan_f32: f32 = math.snan(f32); | |
| 19 | const qnan_f64: f64 = math.nan(f64); | |
| 20 | const snan_f64: f64 = math.snan(f64); | |
| 21 | const qnan_f128: f128 = math.nan(f128); | |
| 22 | const snan_f128: f128 = math.snan(f128); | |
| 23 | ||
| 24 | test "nan memory equality" { | |
| 25 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | |
| 26 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 27 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | |
| 28 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 29 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | |
| 30 | ||
| 31 | // signaled | |
| 32 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u16), mem.asBytes(&snan_f16))); | |
| 33 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u32), mem.asBytes(&snan_f32))); | |
| 34 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u64), mem.asBytes(&snan_f64))); | |
| 35 | try testing.expect(mem.eql(u8, mem.asBytes(&snan_u128), mem.asBytes(&snan_f128))); | |
| 36 | ||
| 37 | // quiet | |
| 38 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u16), mem.asBytes(&qnan_f16))); | |
| 39 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u32), mem.asBytes(&qnan_f32))); | |
| 40 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u64), mem.asBytes(&qnan_f64))); | |
| 41 | try testing.expect(mem.eql(u8, mem.asBytes(&qnan_u128), mem.asBytes(&qnan_f128))); | |
| 42 | } |