Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › std/ › unicode.zig › testUtf8Encode
testUtf8Encode
unicode.testUtf8Encode
fn testUtf8Encode () !void
File
Code
fn testUtf8Encode () !void {
var array : [4 ]u8 = undefined ;
try testing .expect ((try utf8Encode (try utf8Decode ("€" ), array [0 ..])) == 3 );
try testing .expect (array [0 ] == 0b11100010 );
try testing .expect (array [1 ] == 0b10000010 );
try testing .expect (array [2 ] == 0b10101100 );
try testing .expect ((try utf8Encode (try utf8Decode ("$" ), array [0 ..])) == 1 );
try testing .expect (array [0 ] == 0b00100100 );
try testing .expect ((try utf8Encode (try utf8Decode ("¢" ), array [0 ..])) == 2 );
try testing .expect (array [0 ] == 0b11000010 );
try testing .expect (array [1 ] == 0b10100010 );
try testing .expect ((try utf8Encode (try utf8Decode ("𐍈" ), array [0 ..])) == 4 );
try testing .expect (array [0 ] == 0b11110000 );
try testing .expect (array [1 ] == 0b10010000 );
try testing .expect (array [2 ] == 0b10001101 );
try testing .expect (array [3 ] == 0b10001000 );
}