authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-09-21 17:23:06 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-09-21 17:23:06 -07:00
logb5915131ce5b41e58a901973b518f9769215e754
treebf8b0abea08a3e3e070975bc36714634328c7421
parent6da75a0abf28b1b9ff74c6d54e0eba0bf647f9ad

zigmod-test-changes fixes


3 files changed, 8 insertions(+), 8 deletions(-)

build.zig+2-2
...@@ -6,11 +6,11 @@ pub fn build(b: *std.Build) void {...@@ -6,11 +6,11 @@ pub fn build(b: *std.Build) void {
66
7 _ = b.addModule(7 _ = b.addModule(
8 "extras",8 "extras",
9 .{ .root_source_file = .{ .path = "src/lib.zig" } },9 .{ .root_source_file = b.path("src/lib.zig") },
10 );10 );
1111
12 const exe_unit_tests = b.addTest(.{12 const exe_unit_tests = b.addTest(.{
13 .root_source_file = .{ .path = "src/lib.zig" },13 .root_source_file = b.path("src/lib.zig"),
14 .target = target,14 .target = target,
15 .optimize = mode,15 .optimize = mode,
16 });16 });
src/FlippedInt.zig+5-5
...@@ -27,17 +27,17 @@ test {...@@ -27,17 +27,17 @@ test {
27 try std.testing.expect(FlippedInt(u5) == i5);27 try std.testing.expect(FlippedInt(u5) == i5);
28}28}
29test {29test {
30 try std.testing.expect(FlippedInt(i1) == u0);30 try std.testing.expect(FlippedInt(i1) == u1);
31}31}
32test {32test {
33 try std.testing.expect(FlippedInt(i2) == u1);33 try std.testing.expect(FlippedInt(i2) == u2);
34}34}
35test {35test {
36 try std.testing.expect(FlippedInt(i3) == u2);36 try std.testing.expect(FlippedInt(i3) == u3);
37}37}
38test {38test {
39 try std.testing.expect(FlippedInt(i4) == u3);39 try std.testing.expect(FlippedInt(i4) == u4);
40}40}
41test {41test {
42 try std.testing.expect(FlippedInt(i5) == u4);42 try std.testing.expect(FlippedInt(i5) == u5);
43}43}
src/hashFile.zig+1-1
...@@ -18,7 +18,7 @@ pub fn hashFile(dir: std.fs.Dir, sub_path: string, comptime Algo: type) ![Algo.d...@@ -18,7 +18,7 @@ pub fn hashFile(dir: std.fs.Dir, sub_path: string, comptime Algo: type) ![Algo.d
1818
19test {19test {
20 const tdir = std.testing.tmpDir(.{}).dir;20 const tdir = std.testing.tmpDir(.{}).dir;
21 try tdir.writeFile("yo.txt", "hello");21 try tdir.writeFile(.{ .sub_path = "yo.txt", .data = "hello" });
22 const A = std.crypto.hash.sha2.Sha256;22 const A = std.crypto.hash.sha2.Sha256;
23 const expected = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".*;23 const expected = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".*;
24 try std.testing.expect(std.mem.eql(u8, &try hashFile(tdir, "yo.txt", A), &expected));24 try std.testing.expect(std.mem.eql(u8, &try hashFile(tdir, "yo.txt", A), &expected));