From e142621753fb01f97315a9a015f666e44089e222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 16 Mar 2022 06:59:12 +0200 Subject: [PATCH] nits in tests --- src/sections.zig | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/sections.zig b/src/sections.zig index 15154dd..3cd4988 100644 --- a/src/sections.zig +++ b/src/sections.zig @@ -542,19 +542,11 @@ fn testCorpus(allocator: Allocator) !Corpus { ); defer members3.deinit(); - const groups = [_]Group{ Group{ - .gid = 128, - .name = "vidmantas", - .members = members1, - }, Group{ - .gid = 9999, - .name = "all", - .members = members3, - }, Group{ - .gid = 0, - .name = "service-account", - .members = members2, - } }; + const groups = [_]Group{ + Group{ .gid = 128, .name = "vidmantas", .members = members1 }, + Group{ .gid = 9999, .name = "all", .members = members3 }, + Group{ .gid = 0, .name = "service-account", .members = members2 }, + }; return try Corpus.init(allocator, users[0..], groups[0..]); } @@ -705,6 +697,7 @@ test "bdzIdx" { const allocator = testing.allocator; const k_u32 = [_]u32{ 42, 1, 2, 3 }; const k_str = [_][]const u8{ "42", "1", "2", "3" }; + assert(k_u32.len == k_str.len); const mphf_str = try cmph.packStr(allocator, k_str[0..]); const mphf_u32 = try cmph.packU32(allocator, k_u32[0..]); defer allocator.free(mphf_str); @@ -713,7 +706,7 @@ test "bdzIdx" { { var result = try bdzIdx(u32, allocator, mphf_u32, k_u32[0..]); defer allocator.free(result); - var used = [_]bool{false} ** 4; + var used = [_]bool{false} ** k_u32.len; for (result) |elem| used[result[elem]] = true; for (used) |item| try testing.expect(item); } @@ -721,7 +714,7 @@ test "bdzIdx" { { var result = try bdzIdx([]const u8, allocator, mphf_str, k_str[0..]); defer allocator.free(result); - var used = [_]bool{false} ** 4; + var used = [_]bool{false} ** k_u32.len; for (result) |elem| used[result[elem]] = true; for (used) |item| try testing.expect(item); }