@@ -314,11 +314,33 @@ end
314
314
end
315
315
end
316
316
@testset " 128-bit conversion performance" begin
317
- # @test Base.convert(WFD2, 1) == WFD2(1)
318
- # @test @allocated(Base.convert(WFD2, 1)) == 0
317
+ # Baseline cases
318
+ @test @allocated (Base. convert (FD2, Int8 (- 1 ))) == 0
319
+ @test @allocated (Base. convert (FD2, UInt8 (1 ))) == 0
320
+ @test @allocated (Base. convert (SFD2, Int8 (- 1 ))) == 0
321
+
322
+ # Int 128 cases
323
+ @test @allocated (Base. convert (WFD2, 1 )) == 0
324
+ @test @allocated (Base. convert (WFD2, 1 )) == 0
325
+ @test @allocated (Base. convert (UWFD2, 1 )) == 0
326
+ @test @allocated (Base. convert (WFD2, - 1 )) == 0
327
+ # @test @allocated(Base.convert(UWFD2, -1)) == 32 # not sure how best to test this
328
+ @test @allocated (Base. convert (WFD2, UInt (1 ))) == 0
329
+ @test @allocated (Base. convert (UWFD2, UInt (1 ))) == 0
330
+
331
+ @test @allocated (Base. convert (WFD2, Int128 (1 ))) == 0
332
+ @test @allocated (Base. convert (UWFD2, Int128 (1 ))) == 0
333
+ @test @allocated (Base. convert (WFD2, UInt128 (1 ))) == 0
334
+ @test @allocated (Base. convert (UWFD2, UInt128 (1 ))) == 0
335
+ @test @allocated (Base. convert (WFD2, Int128 (- 1 ))) == 0
336
+
337
+ @test @allocated (Base. convert (FD2, Int128 (1 ))) == 0
338
+ @test @allocated (Base. convert (UFD2, Int128 (1 ))) == 0
339
+ @test @allocated (Base. convert (FD2, UInt128 (1 ))) == 0
340
+ @test @allocated (Base. convert (UFD2, UInt128 (1 ))) == 0
341
+ @test @allocated (Base. convert (FD2, Int128 (- 1 ))) == 0
319
342
end
320
343
321
-
322
344
@testset " promotion" begin
323
345
@test 1 // 10 + FD2 (0.1 ) === 1 // 5
324
346
@test 0.1 + FD2 (0.1 ) === 0.2
0 commit comments