userGids unit test
This commit is contained in:
parent
efd3cfc367
commit
e3fd1c833c
@ -466,6 +466,22 @@ test "userGids" {
|
|||||||
|
|
||||||
var user_gids = try userGids(allocator, &corpus);
|
var user_gids = try userGids(allocator, &corpus);
|
||||||
defer user_gids.deinit(allocator);
|
defer user_gids.deinit(allocator);
|
||||||
|
|
||||||
|
for (corpus.users) |user| {
|
||||||
|
const groups = corpus.username2groups.get(user.name);
|
||||||
|
const offset = user_gids.name2offset.get(user.name);
|
||||||
|
if (groups == null) {
|
||||||
|
try testing.expect(offset == null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var vit = try compress.VarintSliceIterator(user_gids.blob[offset.?..]);
|
||||||
|
var it = compress.DeltaDecompressionIterator(&vit);
|
||||||
|
try testing.expectEqual(it.remaining(), groups.?.len);
|
||||||
|
var i: usize = 0;
|
||||||
|
while (try it.next()) |gid| : (i += 1) {
|
||||||
|
try testing.expectEqual(gid, groups.?[i].gid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test "pack gids" {
|
test "pack gids" {
|
||||||
|
Loading…
Reference in New Issue
Block a user