From b5915131ce5b41e58a901973b518f9769215e754 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 21 Sep 2024 17:23:06 -0700 Subject: [PATCH] zigmod-test-changes fixes --- build.zig | 4 ++-- src/FlippedInt.zig | 10 +++++----- src/hashFile.zig | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.zig b/build.zig index 7b40c63125dadc6277995db39df1fa6718c94ba7..24011ec312bb006d54c5048272fbef74d7cbe2eb 100644 --- a/build.zig +++ b/build.zig @@ -6,11 +6,11 @@ pub fn build(b: *std.Build) void { _ = b.addModule( "extras", - .{ .root_source_file = .{ .path = "src/lib.zig" } }, + .{ .root_source_file = b.path("src/lib.zig") }, ); const exe_unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/lib.zig" }, + .root_source_file = b.path("src/lib.zig"), .target = target, .optimize = mode, }); diff --git a/src/FlippedInt.zig b/src/FlippedInt.zig index 9932f8dd948736a5ee20b257a4b8bdad124e8493..4334b4ca6bdccb05d7eb82bd83f6202f9aae607a 100644 --- a/src/FlippedInt.zig +++ b/src/FlippedInt.zig @@ -27,17 +27,17 @@ test { try std.testing.expect(FlippedInt(u5) == i5); } test { - try std.testing.expect(FlippedInt(i1) == u0); + try std.testing.expect(FlippedInt(i1) == u1); } test { - try std.testing.expect(FlippedInt(i2) == u1); + try std.testing.expect(FlippedInt(i2) == u2); } test { - try std.testing.expect(FlippedInt(i3) == u2); + try std.testing.expect(FlippedInt(i3) == u3); } test { - try std.testing.expect(FlippedInt(i4) == u3); + try std.testing.expect(FlippedInt(i4) == u4); } test { - try std.testing.expect(FlippedInt(i5) == u4); + try std.testing.expect(FlippedInt(i5) == u5); } diff --git a/src/hashFile.zig b/src/hashFile.zig index acb4461f7558d28ab9e29c7195d07b983359ffcb..71c2900dd27b756aef2e31812ca904726a308319 100644 --- a/src/hashFile.zig +++ b/src/hashFile.zig @@ -18,7 +18,7 @@ pub fn hashFile(dir: std.fs.Dir, sub_path: string, comptime Algo: type) ![Algo.d test { const tdir = std.testing.tmpDir(.{}).dir; - try tdir.writeFile("yo.txt", "hello"); + try tdir.writeFile(.{ .sub_path = "yo.txt", .data = "hello" }); const A = std.crypto.hash.sha2.Sha256; const expected = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".*; try std.testing.expect(std.mem.eql(u8, &try hashFile(tdir, "yo.txt", A), &expected)); -- 2.54.0