Repository navigation
Expand file tree
/
Copy pathstrings.json
More file actions
209 lines (209 loc) · 6.96 KB
/
Copy pathstrings.json
File metadata and controls
209 lines (209 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{
"type": "bonjson-test",
"version": "1.0.0",
"//": "String encoding tests covering short strings and long strings",
"tests": [
{
"//": "Short string encoding: 0-66 byte strings use type codes 0x65-0xa7",
"name": "short_string_empty",
"type": "encode",
"input": "",
"expected_bytes": "65"
},
{
"//": "Single character 'A' (0x41)",
"name": "short_string_1char",
"type": "encode",
"input": "A",
"expected_bytes": "6641"
},
{
"name": "short_string_a",
"type": "encode",
"input": "a",
"expected_bytes": "6661"
},
{
"name": "short_string_ab",
"type": "encode",
"input": "ab",
"expected_bytes": "676162"
},
{
"name": "short_string_abc",
"type": "encode",
"input": "abc",
"expected_bytes": "68616263"
},
{
"name": "short_string_5bytes",
"type": "encode",
"input": "hello",
"expected_bytes": "6a68656c6c6f"
},
{
"//": "Short strings up to 66 bytes encode the length in the type code",
"name": "short_string_15bytes",
"type": "encode",
"input": "15 byte string!",
"expected_bytes": "743135206279746520737472696e6721"
},
{
"//": "Japanese string (12 UTF-8 bytes)",
"name": "short_string_japanese",
"type": "encode",
"input": "おはよう",
"expected_bytes": "71e3818ae381afe38288e38186"
},
{
"//": "16-byte string uses short string encoding (type code 0x75 = 0x65 + 16)",
"name": "short_string_16bytes",
"type": "encode",
"input": "this is 16 bytes",
"expected_bytes": "7574686973206973203136206279746573"
},
{
"//": "31-byte string uses short string encoding (type code 0x84 = 0x65 + 31)",
"name": "short_string_31bytes",
"type": "encode",
"input": "1234567890123456789012345678901",
"expected_bytes": "8431323334353637383930313233343536373839303132333435363738393031"
},
{
"//": "32-byte string uses short string encoding (type code 0x85 = 0x65 + 32)",
"name": "short_string_32bytes",
"type": "encode",
"input": "12345678901234567890123456789012",
"expected_bytes": "853132333435363738393031323334353637383930313233343536373839303132"
},
{
"//": "64-byte string uses short string encoding (type code 0xa5 = 0x65 + 64)",
"name": "short_string_64bytes",
"type": "encode",
"input": "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
"expected_bytes": "a55a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a"
},
{
"//": "130 character string (length field = 0x11 0x04)",
"name": "long_string_130bytes",
"type": "encode",
"input": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
"expected_bytes": "ff31323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930ff"
},
{
"//": "Decode test: empty long string (0xFF 0x00)",
"name": "decode_long_string_empty",
"type": "decode",
"input_bytes": "ffff",
"expected_value": ""
},
{
"//": "Decode test: 'a string' encoded as long string",
"name": "decode_long_string_astring",
"type": "decode",
"input_bytes": "ff6120737472696e67ff",
"expected_value": "a string"
},
{
"//": "Round-trip tests for various string lengths",
"name": "roundtrip_string_empty",
"type": "roundtrip",
"input": ""
},
{
"name": "roundtrip_string_1char",
"type": "roundtrip",
"input": "x"
},
{
"name": "roundtrip_string_15chars",
"type": "roundtrip",
"input": "fifteen chars!!"
},
{
"name": "roundtrip_string_16chars",
"type": "roundtrip",
"input": "sixteen chars!!!"
},
{
"name": "roundtrip_string_100chars",
"type": "roundtrip",
"input": "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
},
{
"//": "Unicode string round-trips",
"name": "roundtrip_string_unicode_japanese",
"type": "roundtrip",
"input": "日本語"
},
{
"name": "roundtrip_string_unicode_korean",
"type": "roundtrip",
"input": "한국어"
},
{
"name": "roundtrip_string_unicode_emoji",
"type": "roundtrip",
"input": "😀😁😂"
},
{
"name": "roundtrip_string_unicode_mixed",
"type": "roundtrip",
"input": "Hello 世界 🌍"
},
{
"//": "=== String length boundary tests ===",
"//note": "Verify correct encoding at short string boundaries"
},
{
"//": "63-byte string uses short encoding (type code 0xa4 = 0x65 + 63)",
"name": "boundary_string_63_uses_short_encoding",
"type": "encode",
"input": "123456789012345678901234567890123456789012345678901234567890123",
"expected_bytes": "a4313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233"
},
{
"//": "64-byte string still uses short encoding (type code 0xa5 = 0x65 + 64)",
"name": "boundary_string_64_uses_short_encoding",
"type": "encode",
"input": "1234567890123456789012345678901234567890123456789012345678901234",
"expected_bytes": "a531323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334"
},
{
"//": "CJK string round-trip",
"name": "roundtrip_unicode_cjk",
"type": "roundtrip",
"input": "日本語テスト"
},
{
"name": "roundtrip_unicode_emoji_varied",
"type": "roundtrip",
"input": "😀🎉🌍"
},
{
"//": "=== Unicode NFC normalization tests ==="
},
{
"//": "Decomposed 'café' (e + combining acute) normalized to precomposed on decode",
"//note": "Input: 6b = short string len 6, then c(63) a(61) f(66) e(65) combining-acute(cc81)",
"name": "decode_nfc_cafe_decomposed",
"type": "decode",
"input_bytes": "6b63616665cc81",
"expected_value": "café",
"options": {
"unicode_normalization": "nfc"
}
},
{
"//": "Duplicate key detection after NFC normalization: precomposed vs decomposed 'café'",
"//note": "Key1: 6a + café precomposed (c3a9). Key2: 6b + café decomposed (65 cc81). After NFC both are identical.",
"name": "nfc_duplicate_key_detection",
"type": "decode_error",
"input_bytes": "b86a636166c3a9016b63616665cc8102b6",
"expected_error": "duplicate_key",
"options": {
"unicode_normalization": "nfc"
}
}
]
}