@@ -1396,6 +1396,21 @@ end
1396
1396
@test (@allocations " a" * Base. inferencebarrier (" b" )) == 1
1397
1397
end
1398
1398
1399
+ # TODO : merge with `@testset "Base/timing.jl"` once https://github.com/JuliaLang/julia/issues/52948 is resolved
1400
+ @testset " Base/timing.jl2" begin
1401
+ # Test the output of `format_bytes()`
1402
+ inputs = [(factor * (Int64 (1000 )^ e),binary) for binary in (false ,true ), factor in (1 ,2 ), e in 0 : 6 ][:]
1403
+ expected_output = [" 1 byte" , " 1 byte" , " 2 bytes" , " 2 bytes" , " 1000 bytes" , " 1000 bytes" , " 2.000 kB" , " 1.953 KiB" ,
1404
+ " 1000.000 kB" , " 976.562 KiB" , " 2.000 MB" , " 1.907 MiB" , " 1000.000 MB" , " 953.674 MiB" ,
1405
+ " 2.000 GB" , " 1.863 GiB" , " 1000.000 GB" , " 931.323 GiB" , " 2.000 TB" , " 1.819 TiB" ,
1406
+ " 1000.000 TB" , " 909.495 TiB" , " 2.000 PB" , " 1.776 PiB" , " 1000.000 PB" , " 888.178 PiB" ,
1407
+ " 2000.000 PB" , " 1776.357 PiB" ]
1408
+
1409
+ for ((n, binary), expected) in zip (inputs, expected_output)
1410
+ @test Base. format_bytes (n; binary) == expected
1411
+ end
1412
+ end
1413
+
1399
1414
@testset " in_finalizer" begin
1400
1415
@test ! GC. in_finalizer ()
1401
1416
0 commit comments