mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 17:35:12 +00:00
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
32 lines
847 B
Zig
32 lines
847 B
Zig
const std = @import("std");
|
|
const testing = std.testing;
|
|
|
|
pub const Mesh = struct {
|
|
id: u32,
|
|
};
|
|
pub const Material = struct {
|
|
transparent: bool = true,
|
|
emits_shadows: bool = true,
|
|
render_color: bool = true,
|
|
};
|
|
pub const Renderable = struct {
|
|
material: Material,
|
|
// The compiler inserts some padding here to ensure Mesh is correctly aligned.
|
|
mesh: Mesh,
|
|
};
|
|
|
|
var renderable: Renderable = undefined;
|
|
|
|
test "assignment of field with padding" {
|
|
renderable = Renderable{
|
|
.mesh = Mesh{ .id = 0 },
|
|
.material = Material{
|
|
.transparent = false,
|
|
.emits_shadows = false,
|
|
},
|
|
};
|
|
testing.expectEqual(false, renderable.material.transparent);
|
|
testing.expectEqual(false, renderable.material.emits_shadows);
|
|
testing.expectEqual(true, renderable.material.render_color);
|
|
}
|