Comparison

tests/utf8_sequences.txt @ 6594:fa6eb6fb4a80

tests: Add UTF-8 validity tests
author Matthew Wild <mwild1@gmail.com>
date Mon, 23 Mar 2015 17:16:54 +0000
child 6595:89c764cc2424
comparison
equal deleted inserted replaced
6593:828f9f3bdbcf 6594:fa6eb6fb4a80
1 Should pass: 41 42 43 # Simple ASCII - abc
2 Should pass: 41 42 c3 87 # "ABÇ"
3 Should pass: 41 42 e1 b8 88 # "ABḈ"
4 Should pass: 41 42 f0 9d 9c 8d # "AB𝜍"
5 Should pass: F4 8F BF BF # Last valid sequence (U+10FFFF)
6 Should fail: F4 90 80 80 # First invalid sequence (U+110000)
7 Should fail: 80 81 82 83 # Invalid sequence (invalid start byte)
8 Should fail: C2 C3 # Invalid sequence (invalid continuation byte)
9 Should fail: C0 43 # Overlong sequence
10 Should fail: F5 80 80 80 # U+140000 (out of range)
11 Should fail: ED A0 80 # U+D800 (forbidden by RFC 3629)
12 Should fail: ED BF BF # U+DFFF (forbidden by RFC 3629)
13 Should pass: ED 9F BF # U+D7FF (U+D800 minus 1: allowed)
14 Should pass: EE 80 80 # U+E000 (U+D7FF plus 1: allowed)
15 Should fail: C0 # Invalid start byte
16 Should fail: C1 # Invalid start byte
17 Should fail: C2 # Incomplete sequence
18 Should fail: F8 88 80 80 80 # 6-byte sequence
19 Should pass: 7F # Last valid 1-byte sequence (U+00007F)
20 Should pass: DF BF # Last valid 2-byte sequence (U+0007FF)
21 Should pass: EF BF BF # Last valid 3-byte sequence (U+00FFFF)
22 Should pass: 00 # First valid 1-byte sequence (U+000000)
23 Should pass: C2 80 # First valid 2-byte sequence (U+000080)
24 Should pass: E0 A0 80 # First valid 3-byte sequence (U+000800)
25 Should pass: F0 90 80 80 # First valid 4-byte sequence (U+000800)
26 Should fail: F8 88 80 80 80 # First 5-byte sequence - invalid per RFC 3629
27 Should fail: FC 84 80 80 80 80 # First 6-byte sequence - invalid per RFC 3629
28 Should pass: EF BF BD # U+00FFFD (replacement character)
29 Should fail: 80 # First continuation byte
30 Should fail: BF # Last continuation byte
31 Should fail: 80 BF # 2 continuation bytes
32 Should fail: 80 BF 80 # 3 continuation bytes
33 Should fail: 80 BF 80 BF # 4 continuation bytes
34 Should fail: 80 BF 80 BF 80 # 5 continuation bytes
35 Should fail: 80 BF 80 BF 80 BF # 6 continuation bytes
36 Should fail: 80 BF 80 BF 80 BF 80 # 7 continuation bytes
37 Should fail: FE # Impossible byte
38 Should fail: FF # Impossible byte
39 Should fail: FE FE FF FF # Impossible bytes
40 Should fail: C0 AF # Overlong "/"
41 Should fail: E0 80 AF # Overlong "/"
42 Should fail: F0 80 80 AF # Overlong "/"
43 Should fail: F8 80 80 80 AF # Overlong "/"
44 Should fail: FC 80 80 80 80 AF # Overlong "/"
45 Should fail: C0 80 AF # Overlong "/" (invalid)
46 Should fail: C1 BF # Overlong
47 Should fail: E0 9F BF # Overlong
48 Should fail: F0 8F BF BF # Overlong
49 Should fail: F8 87 BF BF BF # Overlong
50 Should fail: FC 83 BF BF BF BF # Overlong
51 Should pass: EF BF BE # U+FFFE (invalid unicode, valid UTF-8)
52 Should fail: EF BF BF # U+FFFF (invalid unicode, valid UTF-8)