This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function
testCalcWtf8Len
Private Function
std.unicode.testCalcWtf8Len
fntestCalcWtf8Len() !void
File
unicode.zig:2185
218521862187218821892190219121922193219421952196
fntestCalcWtf8Len() !void {
constL = utf8ToUtf16LeStringLiteral;
trytesting.expectEqual(@as(usize, 1), calcWtf8Len(L("a")));
trytesting.expectEqual(@as(usize, 10), calcWtf8Len(L("abcdefghij")));
// unpaired surrogatetrytesting.expectEqual(@as(usize, 3), calcWtf8Len(&[_]u16{
mem.nativeToLittle(u16, 0xD800),
}));
trytesting.expectEqual(@as(usize, 15), calcWtf8Len(L("こんにちは")));
// First codepoints that are encoded as 1, 2, 3, and 4 bytestrytesting.expectEqual(@as(usize, 1 + 2 + 3 + 4), calcWtf8Len(L("\u{0}\u{80}\u{800}\u{10000}")));
}