this repo has no description
at main 927 B view raw
1const std = @import("std"); 2const ft = @import("ft"); 3 4pub fn main() !void { 5 // Prints to stderr, ignoring potential errors. 6 std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); 7 try ft.bufferedPrint(); 8} 9 10test "simple test" { 11 const gpa = std.testing.allocator; 12 var list: std.ArrayList(i32) = .empty; 13 defer list.deinit(gpa); // Try commenting this out and see if zig detects the memory leak! 14 try list.append(gpa, 42); 15 try std.testing.expectEqual(@as(i32, 42), list.pop()); 16} 17 18test "fuzz example" { 19 const Context = struct { 20 fn testOne(context: @This(), input: []const u8) anyerror!void { 21 _ = context; 22 // Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case! 23 try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input)); 24 } 25 }; 26 try std.testing.fuzz(Context{}, Context.testOne, .{}); 27}