zig/test/cases/zeroes.zig
Andrew Kelley b581da41f8 remove compiler directives
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`,
   `setFnNoInline` builtin functions to replace previous
   directive functionality
 * add `coldcc` and `nakedcc` as keywords which can be used as part
   of a function prototype.
 * `setDebugSafety` builtin can be used to set debug safety features
   at a per block scope level.
 * closes #169
2016-09-28 02:33:32 -04:00

20 lines
342 B
Zig

const assert = @import("std").debug.assert;
struct Foo {
a: f32,
b: i32,
c: bool,
d: ?i32,
}
fn initializing_a_struct_with_zeroes() {
@setFnTest(this, true);
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);
}