Skip to content

Commit

Permalink
Fixes for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Azzaare committed Aug 5, 2024
1 parent 46e4a1c commit e2111f3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ version = "0.3.12"

[deps]
ConstraintCommons = "e37357d9-0691-492f-a822-e5ea6a920954"
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
PatternFolds = "c18a7f1d-76ad-4ce4-950d-5419b888513b"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[compat]
ConstraintCommons = "0.2"
Dictionaries = "0.4"
Intervals = "1"
PatternFolds = "0.2"
StatsBase = "0.34"
Expand All @@ -23,8 +21,10 @@ julia = "1.8"

[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", "TestItemRunner"]
test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"]
12 changes: 6 additions & 6 deletions src/ConstraintDomains.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module ConstraintDomains

# SECTION - Imports
using ConstraintCommons
using Dictionaries
using PatternFolds
using StatsBase
using TestItems
import ConstraintCommons: ConstraintCommons, δ_extrema
# import Dictionaries
import PatternFolds: PatternFolds, Interval, Closed
import StatsBase: sample
import TestItems: @testitem

# Exports
export AbstractDomain
export ContinuousDomain
export DiscreteDomain
# export DiscreteSet # not defined
export ExploreSettings
export RangeDomain
export SetDomain

export add!
export delete!
Expand Down
2 changes: 1 addition & 1 deletion src/continuous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ domain(intervals::Vector{I}) where {I<:Interval} = Intervals(intervals)
Base.length(itv::Intervals)
Return the sum of the length of each interval in `itv`.
"""
Base.length(itv::Intervals) = sum(size, get_domain(itv); init = 0)
Base.length(itv::Intervals) = sum(size, get_domain(itv); init=0)

"""
Base.rand(itv::Intervals)
Expand Down
4 changes: 2 additions & 2 deletions src/general.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Extends `Base.convert` for domains.
"""
function Base.convert(::Type{Intervals}, d::RangeDomain{T}) where {T<:Real}
a, b = extrema(get_domain(d))
return domain(Float64(a) .. Float64(b))
return domain(Interval{T,Closed,Closed}(a, b))
end

function Base.convert(::Type{RangeDomain}, d::Intervals{T}) where {T<:Real}
Expand All @@ -23,6 +23,6 @@ function Base.convert(::Type{RangeDomain}, d::Intervals{T}) where {T<:Real}
return domain(a:b)
end

function Base.convert(::Type{RangeDomain}, d::SetDomain{T}) where {T<:Integer}
function Base.convert(::Type{RangeDomain}, d::SetDomain)
return domain(collect(get_domain(d)))
end
12 changes: 4 additions & 8 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
@testset "Aqua.jl" begin
import Aqua
import ConstraintDomains
import Dictionaries

# TODO: Fix the broken tests and remove the `broken = true` flag
Aqua.test_all(
ConstraintDomains;
ambiguities = (broken = true,),
deps_compat = false,
piracies = (broken = false,),
ambiguities=(broken=true,),
deps_compat=false,
piracies=(broken=false,),
)

@testset "Ambiguities: ConstraintDomains" begin
Expand All @@ -22,7 +18,7 @@
@testset "Dependencies compatibility (no extras)" begin
Aqua.test_deps_compat(
ConstraintDomains;
check_extras = false, # ignore = [:Random]
check_extras=false,
)
end
end
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(ConstraintDomains) === 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(ConstraintDomains; target_defined_modules=true)
end
9 changes: 8 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
using ConstraintDomains

using Aqua
using ExplicitImports
using JET
using Test
using TestItemRunner

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

0 comments on commit e2111f3

Please sign in to comment.