zig/test/cases3/fn.zig

29 lines
405 B
Zig
Raw Normal View History

2016-12-22 05:20:14 +00:00
fn params() {
@setFnTest(this);
assert(testParamsAdd(22, 11) == 33);
}
fn testParamsAdd(a: i32, b: i32) -> i32 {
a + b
}
fn localVariables() {
@setFnTest(this);
testLocVars(2);
}
fn testLocVars(b: i32) {
const a: i32 = 1;
if (a + b != 3) @unreachable();
}
// TODO const assert = @import("std").debug.assert;
fn assert(ok: bool) {
if (!ok)
@unreachable();
}