sqlite-wasm/testdata/addupto.zig
jmug 0fcd360470 Add a zig wasm function.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2025-04-28 00:09:59 -07:00

15 lines
297 B
Zig

const expect = @import("std").testing.expect;
pub export fn addUpTo(to: u32) u32 {
var res: u32 = 0;
for (0..to) |i| {
res += @intCast(i);
}
return res;
}
test "addUpTo" {
const expected: u32 = 15;
const actual = addUpTo(6);
try expect(actual == expected);
}