Skip to content

Commit

Permalink
added test for x^literal
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Feb 16, 2017
1 parent f23f250 commit 3a0d354
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2902,6 +2902,18 @@ end
@test rem2pi(T(-4), RoundUp) == -4
end

import Base.^
immutable PR20530; end
^(::PR20530, p::Int) = 1
^{p}(::PR20530, ::Type{Val{p}}) = 2
@testset "literal powers" begin
x = PR20530()
p = 2
@test x^p == 1
@test x^2 == 2
@test [x,x,x].^2 == [2,2,2]
end

@testset "iszero" begin
# Numeric scalars
for T in [Float16, Float32, Float64, BigFloat,
Expand Down

0 comments on commit 3a0d354

Please sign in to comment.