mirror of
https://github.com/ziglang/zig.git
synced 2025-12-15 18:53:07 +00:00
check the set of passing tests; move towards the disabling logic being inside each test rather than which files are included. this enables a few more passing tests.
50 lines
1.3 KiB
Zig
50 lines
1.3 KiB
Zig
const builtin = @import("builtin");
|
|
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
const expectEqual = std.testing.expectEqual;
|
|
|
|
const h = @cImport(@cInclude("behavior/translate_c_macros.h"));
|
|
|
|
test "casting to void with a macro" {
|
|
h.IGNORE_ME_1(42);
|
|
h.IGNORE_ME_2(42);
|
|
h.IGNORE_ME_3(42);
|
|
h.IGNORE_ME_4(42);
|
|
h.IGNORE_ME_5(42);
|
|
h.IGNORE_ME_6(42);
|
|
h.IGNORE_ME_7(42);
|
|
h.IGNORE_ME_8(42);
|
|
h.IGNORE_ME_9(42);
|
|
h.IGNORE_ME_10(42);
|
|
}
|
|
|
|
test "initializer list expression" {
|
|
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
|
|
|
|
try expectEqual(h.Color{
|
|
.r = 200,
|
|
.g = 200,
|
|
.b = 200,
|
|
.a = 255,
|
|
}, h.LIGHTGRAY);
|
|
}
|
|
|
|
test "sizeof in macros" {
|
|
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
|
|
|
|
try expectEqual(@as(c_int, @sizeOf(u32)), h.MY_SIZEOF(u32));
|
|
try expectEqual(@as(c_int, @sizeOf(u32)), h.MY_SIZEOF2(u32));
|
|
}
|
|
|
|
test "reference to a struct type" {
|
|
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
|
|
|
|
try expectEqual(@sizeOf(h.struct_Foo), h.SIZE_OF_FOO);
|
|
}
|
|
|
|
test "cast negative integer to pointer" {
|
|
if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
|
|
|
|
try expectEqual(@intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED);
|
|
}
|