Fix some test cases to run on 32bit systems

This commit is contained in:
LemonBoy 2019-05-18 10:59:56 +02:00
parent 51aaa02679
commit 6957927194
2 changed files with 10 additions and 6 deletions

View File

@ -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);
}

View File

@ -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,
};