Skip to content

Commit aaa3e5c

Browse files
test: test new non-concrete promote_operation methods
1 parent daaf53c commit aaa3e5c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/int.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ import MutableArithmetics as MA
2828
)
2929
@test_throws err MA.promote_operation(op, Int, Vector{Int})
3030
end
31+
for op in [+, -, *, /, div]
32+
@test MA.promote_operation(op, Int, Number) == Number
33+
@test MA.promote_operation(op, Number, Int) == Number
34+
end
35+
@test MA.promote_operation(/, Int, Integer) == Float64
36+
@test MA.promote_operation(/, Integer, Integer) == Float64
37+
@test MA.promote_operation(/, Integer, Int) == Float64
38+
@test MA.promote_operation(gcd, Int, Integer) == Integer
39+
@test MA.promote_operation(gcd, Integer, Integer) == Integer
40+
@test MA.promote_operation(gcd, Integer, Int) == Integer
41+
@test MA.promote_operation(&, Integer, Integer, Integer) == Integer
42+
@test MA.promote_operation(&, Integer, Integer, Int) == Integer
43+
3144
end
3245
@testset "add_to!! / add!!" begin
3346
@test MA.mutability(Int, MA.add_to!!, Int, Int) isa MA.IsNotMutable

0 commit comments

Comments
 (0)