Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version #46

Merged
merged 11 commits into from
Oct 9, 2024
16 changes: 8 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name = "PatternFolds"
uuid = "c18a7f1d-76ad-4ce4-950d-5419b888513b"
authors = ["Jean-Francois Baffier"]
version = "0.2.5"
version = "0.2.6"

[deps]
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
Lazy = "50d2b5c4-7a5e-59d5-8109-a42b560f39c0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[compat]
Intervals = "1"
Lazy = "0.15"
Reexport = "1"
TestItemRunner = "0.2, 1"
TestItems = "0.1, 1"
julia = "1.6"
TestItemRunner = "1"
TestItems = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Aqua", "Test"]
test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"]
11 changes: 3 additions & 8 deletions src/PatternFolds.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
module PatternFolds

# Reexporr
using Reexport

# Import
@reexport using Intervals
using Lazy
# using Random
using TestItems
using TestItemRunner
import Intervals: Intervals, Interval, span, Open, Closed
import Lazy: @forward
import TestItems: @testitem

# exports
export IntervalsFold
Expand Down
2 changes: 1 addition & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function make_vector_fold(isf; kind = :mutable)
" The IntervalsFold cannot be converted to a $vf"
@assert is_points(isf) str

return make_vector_fold([value(pattern(isf), :a)], gap(isf), folds(isf), kind)
return make_vector_fold([value(isf)], gap(isf), folds(isf), kind)
end

function Base.print_array(io::IO, X::AbstractVectorFold)
Expand Down
15 changes: 11 additions & 4 deletions src/intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function Base.rand(i::Interval{T, L, R}) where {T, L, R}
δ = β - α
# if δ === Inf
if δ > μ
return rand(rand() < 0.5 ? α .. zero(T) : zero(T) .. β)
return rand(rand() < 0.5 ? Interval{T, Closed, Closed}(α, zero(T)) :
Interval{T, Closed, Closed}(zero(T), β))
else
# r = α + exp10(log10(δ) * rand())
r = α + δ * rand()
Expand All @@ -31,8 +32,6 @@ end

IntervalsFold(p, g, f, c = 1) = IntervalsFold(p, g, f, c)

@forward IntervalsFold.pattern Base.isempty, Base.ndims

Base.lastindex(isf::IntervalsFold) = folds(isf)

Base.getindex(isf::IntervalsFold, key...) = map(k -> get_fold!(isf, k), key)
Expand Down Expand Up @@ -98,6 +97,10 @@ Base.length(isf::IntervalsFold) = folds(isf)

Base.eltype(::Type{<:IntervalsFold{T, L, R}}) where {T, L, R} = Interval{T, L, R}

is_point(i::Interval) = first(i) == last(i) !== nothing

value(isf::IntervalsFold) = pattern(isf) |> first

is_points(isf) = is_point(pattern(isf))

pattern_length(isf::IntervalsFold) = span(pattern(isf))
Expand All @@ -123,7 +126,11 @@ function Base.rand(v::V) where {V <: Set{<:IntervalsFold}}
end
end

@testitem "IntervalsFold" tags=[:intervals] begin
@testitem "IntervalsFold" tags=[:intervals] default_imports=false begin
using Intervals
using Test
using PatternFolds

i01 = Interval{Open, Closed}(0.0, 1.0)
i23 = Interval{Open, Closed}(2.0, 3.0)
i45 = Interval{Open, Closed}(4.0, 5.0)
Expand Down
3 changes: 3 additions & 0 deletions test/ExplicitImports.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@testset "Look for Explicit Imports" begin
@test check_no_implicit_imports(PatternFolds) === nothing
end
3 changes: 3 additions & 0 deletions test/JET.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@testset "Code linting (JET.jl)" begin
JET.test_package(PatternFolds; target_defined_modules = true)
end
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
using PatternFolds

using Aqua
using ExplicitImports
using JET
using Test
using TestItemRunner

@testset "Package tests: PatternFolds" begin
include("Aqua.jl")
include("ExplicitImports.jl")
include("JET.jl")
include("TestItemRunner.jl")
end
Loading