Skip to content

Commit

Permalink
add coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
putianyi889 committed Feb 28, 2024
1 parent b589b47 commit 34c5a38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ jobs:
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: lcov.info
14 changes: 7 additions & 7 deletions src/EltypeExtensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import Base: convert

export elconvert, basetype, baseconvert, precisiontype, precisionconvert

@static if VERSION < v"1.10"
@inline bigfloatconvert(x, prec) = BigFloat(x, prec)
else
@inline bigfloatconvert(x, prec) = BigFloat(x, precision = prec)
end

"""
elconvert(T, A)
Expand Down Expand Up @@ -116,7 +122,7 @@ Convert `A` to have the [`precisiontype`](@ref) of `T`. If `T` has adjustable pr
# Examples
```jldoctest; setup = :(using EltypeExtensions: precisionconvert)
julia> precisionconvert(BigFloat, 1//3+im, 128)
0.3333333333333333333333333333333333333338 + 1.0im
$(repr(bigfloatconvert(1//3, 128))) + 1.0im
julia> precisionconvert(Float16, [[m/n for n in 1:3] for m in 1:3])
3-element $(repr(Vector{Vector{Float16}})):
Expand All @@ -131,10 +137,4 @@ precisionconvert(::Type{BigFloat}, x::Real, prec) = bigfloatconvert(x, prec)
precisionconvert(::Type{BigFloat}, x::Complex, prec) = Complex(bigfloatconvert(real(x), prec), bigfloatconvert(imag(x), prec))
precisionconvert(::Type{BigFloat}, A, prec) = precisionconvert.(BigFloat, A, prec)

@static if VERSION < v"1.10"
@inline bigfloatconvert(x, prec) = BigFloat(x, prec)
else
@inline bigfloatconvert(x, prec) = BigFloat(x, precision = prec)
end

end

0 comments on commit 34c5a38

Please sign in to comment.