Skip to content

Commit

Permalink
Fix test for exponentially growing promote_type (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimikage authored Apr 6, 2024
1 parent 8b9119c commit fd859c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/fixed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,13 @@ end
@test @inferred(promote_type(Float32, Int, Q0f7)) === Float32
@test @inferred(promote_type(Float32, Q0f7, Int)) === Float32

@test @inferred(promote_type(Q0f7,Q1f6,Q2f5,Q3f4,Q4f3,Q5f2)) == Fixed{Int128,7}
if promote_type(Int, Float32, Complex{Int}, typeof(pi)) === ComplexF64
# right-to-left
@test @inferred(promote_type(Q0f7, Q1f6, Q2f5, Q3f4, Q4f3, Q5f2)) == Fixed{Int128,7}
else
# left-to-right
@test @inferred(promote_type(Q5f2, Q4f3, Q3f4, Q2f5, Q1f6, Q0f7)) == Fixed{Int128,7}
end

@test @inferred(promote_type(Q0f7, N0f32)) === Float64
end
Expand Down
8 changes: 7 additions & 1 deletion test/normed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,13 @@ end
@test @inferred(promote_type(Float32, Int, N0f8)) === Float32
@test @inferred(promote_type(Float32, N0f8, Int)) === Float32

@test @inferred(promote_type(N0f8,N1f7,N2f6,N3f5,N4f4,N5f3)) === Normed{UInt128,8}
if promote_type(Int, Float32, Complex{Int}, typeof(pi)) === ComplexF64
# right-to-left
@test @inferred(promote_type(N0f8, N1f7, N2f6, N3f5, N4f4, N5f3)) === Normed{UInt128,8}
else
# left-to-right
@test @inferred(promote_type(N5f3, N4f4, N3f5, N2f6, N1f7, N0f8)) === Normed{UInt128,8}
end

@test @inferred(promote_type(N0f8, Q0f31)) === Float64
end
Expand Down

0 comments on commit fd859c7

Please sign in to comment.