Skip to content

Commit cd6c154

Browse files
committed
Update
1 parent b742261 commit cd6c154

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

test/big.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,10 @@ end
4545
@testset "$T" for T in [BigInt, BigFloat, Rational{BigInt}]
4646
MA.Test.int_test(T)
4747
@testset "Allocation" begin
48-
a, b = T(2), T(3)
49-
a + b, a - b, a * b # compilation
50-
# Test that the MA methods have fewer allocated than the Base method
51-
n = T <: Rational ? (@allocated a + b) - 1 : 0
52-
allocation_test(+, T, MA.add!!, MA.add_to!!, n)
53-
n = T <: Rational ? (@allocated a - b) - 1 : 0
54-
allocation_test(-, T, MA.sub!!, MA.sub_to!!, n)
55-
n = T <: Rational ? (@allocated a * b) - 1 : 0
56-
allocation_test(*, T, MA.mul!!, MA.mul_to!!, n)
48+
MAX_ALLOC = T <: Rational ? 240 : 0
49+
allocation_test(+, T, MA.add!!, MA.add_to!!, MAX_ALLOC)
50+
allocation_test(-, T, MA.sub!!, MA.sub_to!!, MAX_ALLOC)
51+
allocation_test(*, T, MA.mul!!, MA.mul_to!!, MAX_ALLOC)
5752
add_sub_mul_test(MA.add_mul, T)
5853
add_sub_mul_test(MA.sub_mul, T)
5954
if T <: Rational # https://github.com/jump-dev/MutableArithmetics.jl/issues/167
@@ -62,7 +57,7 @@ end
6257
T,
6358
MA.add!!,
6459
MA.add_to!!,
65-
(@allocated a + b) - 1,
60+
MAX_ALLOC,
6661
a = T(1 // 2),
6762
b = T(3 // 2),
6863
c = T(5 // 2),
@@ -72,7 +67,7 @@ end
7267
T,
7368
MA.sub!!,
7469
MA.sub_to!!,
75-
(@allocated a - b) - 1,
70+
MAX_ALLOC,
7671
a = T(1 // 2),
7772
b = T(3 // 2),
7873
c = T(5 // 2),

0 commit comments

Comments
 (0)