1const std = @import("std");
2const string = []const u8;
3const extras = @import("./lib.zig");
4
5pub fn sumLen(comptime T: type, slice: []const []const T) u64 {
6 var res: u64 = 0;
7 for (slice) |item| res += item.len;
8 return res;
9}
10
11test {
12 try std.testing.expect(sumLen(u8, &.{ &.{4}, &.{3}, &.{0}, &.{9}, &.{6}, &.{7}, &.{1}, &.{2}, &.{5}, &.{8} }) == 10);
13}
14test {
15 try std.testing.expect(sumLen(u16, &.{ &.{ 8, 6 }, &.{ 7, 3 }, &.{ 2, 1 }, &.{ 5, 0 }, &.{ 9, 4 } }) == 10);
16}
17test {
18 try std.testing.expect(sumLen(u21, &.{ &.{ 5, 4, 6 }, &.{ 1, 8, 3, 2 }, &.{ 9, 0, 7 } }) == 10);
19}
20test {
21 try std.testing.expect(sumLen(u32, &.{ &.{ 3, 4 }, &.{ 5, 1, 9, 0, 6, 2, 7, 8 } }) == 10);
22}
23test {
24 try std.testing.expect(sumLen(u40, &.{ &.{ 0, 5, 6, 7, 1, 2 }, &.{ 4, 9, 3, 8 } }) == 10);
25}
26test {
27 try std.testing.expect(sumLen(u64, &.{&.{ 5, 4, 3, 9, 1, 7, 6, 2, 0, 8 }}) == 10);
28}