zig/test/cases/zeroes.zig
2016-08-08 20:43:38 -07:00

19 lines
332 B
Zig

const assert = @import("std").debug.assert;
struct Foo {
a: f32,
b: i32,
c: bool,
d: ?i32,
}
#attribute("test")
fn initializing_a_struct_with_zeroes() {
const foo: Foo = zeroes;
assert(foo.a == 0.0);
assert(foo.b == 0);
assert(foo.c == false);
assert(if (const x ?= foo.d) false else true);
}