diff options
| author | Igor Stojkovic <stojkovic.igor+git@gmail.com> | 2022-03-23 20:29:53 +0100 |
|---|---|---|
| committer | Igor Stojkovic <stojkovic.igor+git@gmail.com> | 2022-03-26 09:03:37 +0100 |
| commit | 109e730c8ccdfe144f568f232578ab600ef4f33c (patch) | |
| tree | b11984e11dd73151110d5de5bf32d4ff1a14141d /test/behavior/struct.zig | |
| parent | af844931b2600e50e586436dee0d607d67ed9ff2 (diff) | |
| download | zig-109e730c8ccdfe144f568f232578ab600ef4f33c.tar.gz zig-109e730c8ccdfe144f568f232578ab600ef4f33c.zip | |
stage1: Fix packed structs (#2627, #10104)
Fixed formatting in packed-struct-zig
Skipped packed_structs tests in stage2
simplified packed struct tests
Diffstat (limited to 'test/behavior/struct.zig')
| -rw-r--r-- | test/behavior/struct.zig | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 4bed1f56cc..ccfcd7d74f 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -422,11 +422,21 @@ test "packed struct 24bits" { if (builtin.cpu.arch == .arm) return error.SkipZigTest; // TODO comptime { - try expect(@sizeOf(Foo24Bits) == 4); - if (@sizeOf(usize) == 4) { - try expect(@sizeOf(Foo96Bits) == 12); + // TODO Remove if and leave only the else branch when it is also fixed in stage2 + if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_x86 or + builtin.zig_backend == .stage2_riscv64) + { + // Stage 2 still expects the wrong values + try expect(@sizeOf(Foo24Bits) == 4); + if (@sizeOf(usize) == 4) { + try expect(@sizeOf(Foo96Bits) == 12); + } else { + try expect(@sizeOf(Foo96Bits) == 16); + } } else { - try expect(@sizeOf(Foo96Bits) == 16); + // Stage1 is now fixed and is expected to return right values + try expectEqual(@sizeOf(Foo24Bits), 3); + try expectEqual(@sizeOf(Foo96Bits), 12); } } |
