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 standard library.
std › unicode › testUtf8ToUtf16LeStringLiteral Private Function testUtf8ToUtf16LeStringLiteral Doc Source Private Function std.unicode.testUtf8ToUtf16LeStringLiteral
fn testUtf8ToUtf16LeStringLiteral (utf8ToUtf16LeStringLiteral_ : anytype ) !void Params utf8ToUtf16LeStringLiteral_ File unicode.zig: 1540
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591 fn testUtf8ToUtf16LeStringLiteral (utf8ToUtf16LeStringLiteral_ : anytype ) !void {
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0x41 ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("A" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [1 ] == 0 );
}
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0xD801 ),
mem .nativeToLittle (u16 , 0xDC37 ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("𐐷" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [2 ] == 0 );
}
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0x02FF ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("\u{02FF}" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [1 ] == 0 );
}
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0x7FF ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("\u{7FF}" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [1 ] == 0 );
}
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0x801 ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("\u{801}" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [1 ] == 0 );
}
{
const bytes = [_ :0 ]u16 {
mem .nativeToLittle (u16 , 0xDBFF ),
mem .nativeToLittle (u16 , 0xDFFF ),
};
const utf16 = utf8ToUtf16LeStringLiteral_ ("\u{10FFFF}" );
try testing .expectEqualSlices (u16 , &bytes , utf16 );
try testing .expect (utf16 [2 ] == 0 );
}
}