Skip to content

Commit 55ea37e

Browse files
committed
Better test
1 parent bc807e5 commit 55ea37e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/explore.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ settings = ExploreSettings(domains, search = :complete)
3434
"""
3535
function ExploreSettings(
3636
domains;
37-
complete_search_limit = 10^6,
38-
max_samplings = sum(domain_size, domains; init = 0),
39-
search = :flexible,
40-
solutions_limit = floor(Int, sqrt(max_samplings)),
37+
complete_search_limit=10^6,
38+
max_samplings=sum(domain_size, domains; init=0),
39+
search=:flexible,
40+
solutions_limit=floor(Int, sqrt(max_samplings)),
4141
)
4242
return ExploreSettings(complete_search_limit, max_samplings, search, solutions_limit)
4343
end
@@ -85,8 +85,8 @@ explorer = Explorer(concepts, domains, objective)
8585
function Explorer(
8686
concepts,
8787
domains,
88-
objective = nothing;
89-
settings = ExploreSettings(domains),
88+
objective=nothing;
89+
settings=ExploreSettings(domains),
9090
)
9191
F1 = isempty(concepts) ? Function : Union{map(c -> typeof(c[1]), concepts)...}
9292
D = isempty(domains) ? AbstractDomain : Union{map(typeof, domains)...}
@@ -124,7 +124,7 @@ key = push!(explorer, (sum, [1, 2]))
124124
```
125125
"""
126126
function Base.push!(explorer::Explorer, concept::Tuple{Function,Vector{Int}})
127-
max_key = maximum(keys(explorer.concepts); init = 0)
127+
max_key = maximum(keys(explorer.concepts); init=0)
128128
explorer.concepts[max_key+1] = concept
129129
return max_key + 1
130130
end
@@ -171,7 +171,7 @@ key = push!(explorer, domain([1, 2, 3]))
171171
```
172172
"""
173173
function Base.push!(explorer::Explorer, domain::AbstractDomain)
174-
max_key = maximum(keys(explorer.domains); init = 0)
174+
max_key = maximum(keys(explorer.domains); init=0)
175175
explorer.domains[max_key+1] = domain
176176
return max_key + 1
177177
end
@@ -219,7 +219,7 @@ set!(explorer, x -> sum(x))
219219
"""
220220
set!(explorer::Explorer, objective::Function) = explorer.objective = objective
221221

222-
function update_exploration!(explorer, f, c, search = explorer.settings.search)
222+
function update_exploration!(explorer, f, c, search=explorer.settings.search)
223223
solutions = explorer.state.solutions
224224
non_sltns = explorer.state.non_solutions
225225
obj = explorer.objective
@@ -261,7 +261,7 @@ function _explore!(explorer, f, ::Val{:partial};)
261261
end
262262

263263
function _explore!(explorer, f, ::Val{:complete})
264-
C = Base.Iterators.product(map(d -> get_domain(d), explorer.domains |> values)...)
264+
C = Base.Iterators.product(Iterators.map(d -> get_domain(d), explorer.domains |> values)...)
265265
foreach(c -> update_exploration!(explorer, f, c, :complete), C)
266266
return nothing
267267
end
@@ -322,7 +322,7 @@ domains = [domain([1, 2, 3]), domain([4, 5, 6])]
322322
solutions, non_solutions = explore(domains, allunique)
323323
```
324324
"""
325-
function explore(domains, concept; settings = ExploreSettings(domains), parameters...)
325+
function explore(domains, concept; settings=ExploreSettings(domains), parameters...)
326326
f = x -> concept(x; parameters...)
327327
explorer = Explorer([(f, Vector{Int}())], domains; settings)
328328
explore!(explorer)
@@ -346,5 +346,5 @@ end
346346
@test length(X) == factorial(4)
347347
@test length(X̅) == 4^4 - factorial(4)
348348

349-
explorer = ConstraintDomains.Explorer()
349+
explorer = ConstraintDomains.Explorer([(allunique, 1:4)], domains)
350350
end

0 commit comments

Comments
 (0)