4
4
u8 = " \U 10ffff\U 1d565\U 1d7f6\U 00066\U 2008a"
5
5
u32 = utf32 (u8)
6
6
@test sizeof (u32) == 20
7
- @test length (u32. data) == 6 && u32. data[end ] == Char ( 0 )
7
+ @test length (u32. data) == 6 && u32. data[end ] == 0
8
8
@test length (u32) == 5
9
9
@test utf8 (u32) == u8
10
10
@test collect (u8) == collect (u32)
@@ -181,13 +181,13 @@ for (fun, S, T) in ((utf16, UInt16, UTF16String), (utf32, UInt32, UTF32String))
181
181
str = " abcd\0\u ff\u 7ff\u 7fff\U 7ffff"
182
182
tst = SubString (convert (T,str),4 )
183
183
cmp = Char[' d' ,' \0 ' ,' \u ff' ,' \u 7ff' ,' \u 7fff' ,' \U 7ffff' ]
184
- cmpch = Char [' d' ,' \0 ' ,' \u ff' ,' \u 7ff' ,' \u 7fff' ,' \U 7ffff' ,' \0 ' ]
184
+ cmp32 = UInt32 [' d' ,' \0 ' ,' \u ff' ,' \u 7ff' ,' \u 7fff' ,' \U 7ffff' ,' \0 ' ]
185
185
cmp16 = UInt16[0x0064 ,0x0000 ,0x00ff ,0x07ff ,0x7fff ,0xd9bf ,0xdfff ,0x0000 ]
186
186
x = fun (tst)
187
- cmpx = (S == UInt16 ? cmp16 : cmpch )
187
+ cmpx = (S == UInt16 ? cmp16 : cmp32 )
188
188
@test typeof (tst) == SubString{T}
189
189
@test convert (T, tst) == str[4 : end ]
190
- S != UInt32 && @test convert (Vector{Char}, x) == cmp
190
+ @test convert (Vector{Char}, x) == cmp
191
191
# Vector{T} / Array{T}
192
192
@test convert (Vector{S}, x) == cmpx
193
193
@test convert (Array{S}, x) == cmpx
@@ -223,9 +223,9 @@ let str = ascii("this ")
223
223
@test typeof (p8) == Ptr{UInt8}
224
224
@test unsafe_load (p8,1 ) == 0x74
225
225
@test typeof (p16) == Ptr{UInt16}
226
- @test unsafe_load (p16,1 ) == 0x0074
226
+ @test unsafe_load (p16,1 ) == 0x74
227
227
@test typeof (p32) == Ptr{UInt32}
228
- @test unsafe_load (p32,1 ) == ' t '
228
+ @test unsafe_load (p32,1 ) == 0x74
229
229
pa = pointer (str, 2 )
230
230
p8 = pointer (u8, 2 )
231
231
p16 = pointer (u16, 2 )
@@ -235,9 +235,9 @@ let str = ascii("this ")
235
235
@test typeof (p8) == Ptr{UInt8}
236
236
@test unsafe_load (p8,1 ) == 0x68
237
237
@test typeof (p16) == Ptr{UInt16}
238
- @test unsafe_load (p16,1 ) == 0x0068
238
+ @test unsafe_load (p16,1 ) == 0x68
239
239
@test typeof (p32) == Ptr{UInt32}
240
- @test unsafe_load (p32,1 ) == ' h '
240
+ @test unsafe_load (p32,1 ) == 0x68
241
241
sa = SubString {ASCIIString} (str, 3 , 5 )
242
242
s8 = SubString {UTF8String} (u8, 3 , 5 )
243
243
s16 = SubString {UTF16String} (u16, 3 , 5 )
@@ -251,9 +251,9 @@ let str = ascii("this ")
251
251
@test typeof (p8) == Ptr{UInt8}
252
252
@test unsafe_load (p8,1 ) == 0x69
253
253
@test typeof (p16) == Ptr{UInt16}
254
- @test unsafe_load (p16,1 ) == 0x0069
254
+ @test unsafe_load (p16,1 ) == 0x69
255
255
@test typeof (p32) == Ptr{UInt32}
256
- @test unsafe_load (p32,1 ) == ' i '
256
+ @test unsafe_load (p32,1 ) == 0x69
257
257
pa = pointer (sa, 2 )
258
258
p8 = pointer (s8, 2 )
259
259
p16 = pointer (s16, 2 )
@@ -263,9 +263,9 @@ let str = ascii("this ")
263
263
@test typeof (p8) == Ptr{UInt8}
264
264
@test unsafe_load (p8,1 ) == 0x73
265
265
@test typeof (p16) == Ptr{UInt16}
266
- @test unsafe_load (p16,1 ) == 0x0073
266
+ @test unsafe_load (p16,1 ) == 0x73
267
267
@test typeof (p32) == Ptr{UInt32}
268
- @test unsafe_load (p32,1 ) == ' s '
268
+ @test unsafe_load (p32,1 ) == 0x73
269
269
end
270
270
271
271
@test isvalid (Char[' f' ,' o' ,' o' ,' b' ,' a' ,' r' ])
0 commit comments