]> gitweb.ps.run Git - iftint.zig/blob - src/root.zig
codebaze
[iftint.zig] / src / root.zig
1 //! By convention, root.zig is the root source file when making a library.
2 const std = @import("std");
3
4 pub fn bufferedPrint() !void {
5     // Stdout is for the actual output of your application, for example if you
6     // are implementing gzip, then only the compressed bytes should be sent to
7     // stdout, not any debugging messages.
8     var stdout_buffer: [1024]u8 = undefined;
9     var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
10     const stdout = &stdout_writer.interface;
11
12     try stdout.print("Run `zig build test` to run the tests.\n", .{});
13
14     try stdout.flush(); // Don't forget to flush!
15 }
16
17 pub fn add(a: i32, b: i32) i32 {
18     return a + b;
19 }
20
21 test "basic add functionality" {
22     try std.testing.expect(add(3, 7) == 10);
23 }