@@ -320,6 +320,23 @@ test_many_wrappers(fill(1.0, 5, 3), (identity, wrapper)) do a_
320
320
@test r[goodinds... ] == - 5
321
321
end
322
322
end
323
+
324
+ let a = rand (ComplexF32, 5 )
325
+ r = reinterpret (reshape, Float32, a)
326
+ ref = Array (r)
327
+
328
+ @test r[1 , :, 1 ] == ref[1 , :]
329
+ @test r[1 , :, 1 , 1 , 1 ] == ref[1 , :]
330
+ @test r[1 , :, UInt8 (1 )] == ref[1 , :]
331
+
332
+ r[2 , :, 1 ] .= 0f0
333
+ ref[2 , :] .= 0f0
334
+ @test r[2 , :, 1 ] == ref[2 , :]
335
+
336
+ @test r[4 ] == ref[4 ]
337
+ @test_throws BoundsError r[1 , :, 2 ]
338
+ end
339
+
323
340
let ar = [(1 ,2 ), (3 ,4 )]
324
341
arr = reinterpret (reshape, Int, ar)
325
342
@test @inferred (IndexStyle (arr)) == Base. IndexSCartesian2 {2} ()
@@ -607,3 +624,9 @@ let R = reinterpret(reshape, Float32, ComplexF32[1.0f0+2.0f0*im, 4.0f0+3.0f0*im]
607
624
@test ! isassigned (R, 5 )
608
625
@test Array (R):: Matrix{Float32} == [1.0f0 4.0f0 ; 2.0f0 3.0f0 ]
609
626
end
627
+
628
+ @testset " issue #54623" begin
629
+ x = 0xabcdef01234567
630
+ @test reinterpret (reshape, UInt8, fill (x)) == [0x67 , 0x45 , 0x23 , 0x01 , 0xef , 0xcd , 0xab , 0x00 ]
631
+ @test reinterpret (reshape, UInt8, [x]) == [0x67 ; 0x45 ; 0x23 ; 0x01 ; 0xef ; 0xcd ; 0xab ; 0x00 ;;]
632
+ end
0 commit comments