Skip to content

Commit

Permalink
More testing for patch release
Browse files Browse the repository at this point in the history
  • Loading branch information
perrutquist committed Jun 29, 2020
1 parent 5c3b61c commit e3e24a3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Zeros"
uuid = "bd1ec220-6eb4-527a-9b49-e79c3db6233b"
authors = ["Per Rutquist <[email protected]>"]
version = "0.2.1"
version = "0.2.2"

[compat]
julia = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions src/Zeros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ One(x::Number) = isone(x) ? One() : throw(InexactError(:One, One, x))
# disambig
Zero(::Zero) = Zero()
One(::One) = One()
Zero(::One) = throw(InexactError(:Zero, Zero, One()))
One(::Zero) = throw(InexactError(:One, One, Zero()))

Base.AbstractFloat(::Zero) = 0.0
Base.AbstractFloat(::One) = 1.0
Expand Down
31 changes: 31 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,22 @@ end

@test log(I) == log(1)
@test log(I) === Z
@test log2(I) == log2(1)
@test log2(I) === Z
@test log10(I) == log10(1)
@test log10(I) === Z
@test log1p(Z) == log1p(0)
@test log1p(Z) === Z
@test exp(Z) == exp(0)
@test exp(Z) === I
@test expm1(Z) == expm1(0)
@test expm1(Z) === Z
@test sin(Z) == sin(0)
@test sin(Z) === Z
@test cos(Z) == cos(0)
@test cos(Z) === I
@test sincos(Z) == sincos(0)
@test sincos(Z) === (Z, I)
@test tan(Z) == tan(0)
@test tan(Z) === Z
@test asin(Z) == asin(0)
Expand All @@ -151,6 +161,10 @@ end
@test sqrt(Z) === Z
@test sqrt(I) == sqrt(1)
@test sqrt(I) === I
@test cbrt(Z) == cbrt(0)
@test cbrt(Z) === Z
@test cbrt(I) == cbrt(1)
@test cbrt(I) === I

@test 3.0^Z === I
@test 3.0f0^Z === I
Expand Down Expand Up @@ -187,6 +201,20 @@ end

@test false + Zero() === false
@test Zero() + false === false

@test Integer(Z) === 0
@test Integer(I) === 1

@test AbstractFloat(Z) === 0.0
@test AbstractFloat(I) === 1.0

@test Zero(Z) === Z
@test One(I) === I

@test inv(I) === I

@test div(3, I) === 3
@test div(Int32(3), I) === Int32(3)
end

# @testset "muladd" begin
Expand Down Expand Up @@ -235,6 +263,9 @@ end
@test_throws DivideError (1.0+2.0im)/Z
@test_throws DivideError Z/Z
@test_throws DivideError I/Z
@test_throws DivideError inv(Z)
@test_throws InexactError Zero(One())
@test_throws InexactError One(Zero())
end

# Test `MyComplex` example type
Expand Down

2 comments on commit e3e24a3

@perrutquist
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/17161

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.2 -m "<description of version>" e3e24a3ba062cef159fdca53f2d397fe46b8a5fc
git push origin v0.2.2

Please sign in to comment.