Commit 6957927194

LemonBoy <thatlemon@gmail.com>
2019-05-18 10:59:56
Fix some test cases to run on 32bit systems
1 parent 51aaa02
Changed files (2)
test
stage1
test/stage1/behavior/pointers.zig
@@ -132,8 +132,8 @@ test "initialize const optional C pointer to null" {
 }
 
 test "compare equality of optional and non-optional pointer" {
-    const a = @intToPtr(*const usize, 0x123456789);
-    const b = @intToPtr(?*usize, 0x123456789);
+    const a = @intToPtr(*const usize, 0x12345678);
+    const b = @intToPtr(?*usize, 0x12345678);
     expect(a == b);
     expect(b == a);
 }
test/stage1/behavior/struct.zig
@@ -2,7 +2,7 @@ const std = @import("std");
 const expect = std.testing.expect;
 const expectEqualSlices = std.testing.expectEqualSlices;
 const builtin = @import("builtin");
-const maxInt = std.math.maxInt; 
+const maxInt = std.math.maxInt;
 const StructWithNoFields = struct {
     fn add(a: i32, b: i32) i32 {
         return a + b;
@@ -256,7 +256,11 @@ const Foo96Bits = packed struct {
 test "packed struct 24bits" {
     comptime {
         expect(@sizeOf(Foo24Bits) == 4);
-        expect(@sizeOf(Foo96Bits) == 16);
+        if (@sizeOf(usize) == 4) {
+            expect(@sizeOf(Foo96Bits) == 12);
+        } else {
+            expect(@sizeOf(Foo96Bits) == 16);
+        }
     }
 
     var value = Foo96Bits{
@@ -505,10 +509,10 @@ test "packed struct with u0 field access" {
     comptime expect(s.f0 == 0);
 }
 
-const S0 = struct{
+const S0 = struct {
     bar: S1,
 
-    pub const S1 = struct{
+    pub const S1 = struct {
         value: u8,
     };