Initial Commit

This commit is contained in:
David Allemang
2025-01-15 16:47:59 -05:00
commit 2b3734a087
7 changed files with 157 additions and 0 deletions

35
src/main.zig Normal file
View File

@@ -0,0 +1,35 @@
const std = @import("std");
const lib = @import("zig-shape-lib");
pub fn main() !void {
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
const stdout_file = std.io.getStdOut().writer();
var bw = std.io.bufferedWriter(stdout_file);
const stdout = bw.writer();
try stdout.print("Run `zig build test` to run the tests.\n", .{});
try bw.flush();
}
test "simple test" {
var list = std.ArrayList(i32).init(std.testing.allocator);
defer list.deinit();
try list.append(42);
try std.testing.expectEqual(@as(i32, 42), list.pop());
}
test "use other module" {
try std.testing.expectEqual(@as(i32, 150), lib.add(100, 50));
}
test "fuzz example" {
const global = struct {
fn testOne(input: []const u8) anyerror!void {
// Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case!
try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input));
}
};
try std.testing.fuzz(global.testOne, .{});
}