Skip to content

Commit

Permalink
Add tests, update CI and README (#10)
Browse files Browse the repository at this point in the history
* Add a couple of tests
* Fix some bitrot
  • Loading branch information
jlapeyre authored Sep 30, 2024
1 parent decc207 commit b2cea24
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- '1.0' # oldest supported release
- '1.6' # LTS
- '1' # stable release
- 'nightly'
# - 'nightly' # nightly is incompatible with JET, probably
os:
- ubuntu-latest
- macOS-latest
Expand All @@ -42,6 +42,8 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ authors = ["John Lapeyre <[email protected]>"]
version = "0.2.4"

[compat]
Aqua = ">= 0.8"
julia = "1"
JET = ">= 0.0"
Test = ">= 0.0"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# ILog2

[![Build Status](https://github.com/JuliaMath/ILog2.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/JuliaMath/ILog2.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/JuliaMath/ILog2.jl?svg=true)](https://ci.appveyor.com/project/JuliaMath/ILog2-jl)
[![Codecov](https://codecov.io/gh/JuliaMath/ILog2.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaMath/ILog2.jl)
[![Coveralls](https://coveralls.io/repos/github/JuliaMath/ILog2.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaMath/ILog2.jl?branch=master)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
[![JET QA](https://img.shields.io/badge/JET.jl-%E2%9C%88%EF%B8%8F-%23aa4444)](https://github.com/aviatesk/JET.jl)
[![](https://img.shields.io/badge/%F0%9F%9B%A9%EF%B8%8F_tested_with-JET.jl-233f9a)](https://github.com/aviatesk/JET.jl)

This package provides a fast implementation of the integer-valued, base-2 logarithm.
`ilog2` supports other types of numbers, as well. It also provides `checkispow2`.

`ilog2(n::Real)` compute the largest `m` such that `2^m <= n`.


`ilog2(n::Real, RoundUp)` compute the smallest `m` such that `2^m >= n`.


`checkispow2(n::Number)` returns `ilog2(n)` if `n` is a power of two.
Otherwise throws a `DomainError`.
9 changes: 2 additions & 7 deletions test/aqua_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ using Aqua: Aqua
Aqua.test_deps_compat(ILog2)
end

# This often gives false positive
# @testset "aqua project toml formatting" begin
# Aqua.test_project_toml_formatting(ILog2)
# end

@testset "aqua unbound_args" begin
Aqua.test_unbound_args(ILog2)
end
Expand All @@ -24,8 +19,8 @@ end
Aqua.test_ambiguities([ILog2, Core, Base])
end

@testset "aqua piracy" begin
Aqua.test_piracy(ILog2)
@testset "aqua piracies" begin
Aqua.test_piracies(ILog2)
end

@testset "aqua project extras" begin
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ end
@test ilog2(T(n)) == ilog2(float(n))
end
end

@test ilog2(20//2) == 3
@test ilog2(true) === false
@test_throws InexactError ilog2(false)
end

@testset "Large Float64" begin
Expand Down

0 comments on commit b2cea24

Please sign in to comment.