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,10 +235,10 @@ 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 '
241
- s8 = SubString {String} (u8, 3 , 5 )
240
+ @test unsafe_load (p32,1 ) == 0x68
241
+ s8 = SubString {String} (u8, 3 , 5 )
242
242
s16 = SubString {UTF16String} (u16, 3 , 5 )
243
243
s32 = SubString {UTF32String} (u32, 3 , 5 )
244
244
p8 = pointer (s8)
@@ -247,18 +247,18 @@ let str = ascii("this ")
247
247
@test typeof (p8) == Ptr{UInt8}
248
248
@test unsafe_load (p8,1 ) == 0x69
249
249
@test typeof (p16) == Ptr{UInt16}
250
- @test unsafe_load (p16,1 ) == 0x0069
250
+ @test unsafe_load (p16,1 ) == 0x69
251
251
@test typeof (p32) == Ptr{UInt32}
252
- @test unsafe_load (p32,1 ) == ' i '
252
+ @test unsafe_load (p32,1 ) == 0x69
253
253
p8 = pointer (s8, 2 )
254
254
p16 = pointer (s16, 2 )
255
255
p32 = pointer (s32, 2 )
256
256
@test typeof (p8) == Ptr{UInt8}
257
257
@test unsafe_load (p8,1 ) == 0x73
258
258
@test typeof (p16) == Ptr{UInt16}
259
- @test unsafe_load (p16,1 ) == 0x0073
259
+ @test unsafe_load (p16,1 ) == 0x73
260
260
@test typeof (p32) == Ptr{UInt32}
261
- @test unsafe_load (p32,1 ) == ' s '
261
+ @test unsafe_load (p32,1 ) == 0x73
262
262
end
263
263
264
264
@test isvalid (Char[' f' ,' o' ,' o' ,' b' ,' a' ,' r' ])
0 commit comments