Skip to content

Commit

Permalink
Clean up uses of produce! and exported API
Browse files Browse the repository at this point in the history
These were somehow missed in the refactor. While we're at it,
also clean up the exported API from the main module.
  • Loading branch information
Seelengrab committed Mar 4, 2024
1 parent b9a76aa commit 2988f55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/Supposition.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Supposition

export TestCase, TestState, forced_choice!, choice!, weighted!, assume!, target!, reject, example
export assume!, target!, reject, example
export Data, @composed, @check

using Base
Expand All @@ -25,6 +25,9 @@ include("api.jl")
include("history.jl")
include("testset.jl")

using .Data: produce!
export produce!

"""
DEFAULT_CONFIG
Expand Down
2 changes: 1 addition & 1 deletion src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,4 @@ Produces a value from the given `Possibility`, recording the required choices in
is being actively generated. It is ok to call this inside of `@composed` or `@check`, as well as any
functions only intended to be called from one of those places.
"""
produce!(p::Data.Possibility) = Data.produce!(CURRENT_TESTCASE[], p)
Data.produce!(p::Data.Possibility) = Data.produce!(CURRENT_TESTCASE[], p)
2 changes: 1 addition & 1 deletion src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ as well as these utility functions:
module Data

using Supposition
using Supposition: smootherstep, lerp
using Supposition: smootherstep, lerp, TestCase, choice!, weighted!, forced_choice!
using RequiredInterfaces: @required

"""
Expand Down
7 changes: 4 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Supposition
using Supposition: Data, test_function, shrink_remove, shrink_redistribute, NoRecordDB, Attempt, DEFAULT_CONFIG
using Supposition: Data, test_function, shrink_remove, shrink_redistribute,
NoRecordDB, Attempt, DEFAULT_CONFIG, TestCase, TestState, choice!, weighted!
using Test
using Aqua
using Random
Expand Down Expand Up @@ -591,12 +592,12 @@ const verb = VERSION.major == 1 && VERSION.minor < 11

@testset "inner produce" begin
gen = @composed function inner(i=Data.Integers{UInt8}())
j = Data.produce!(Data.Integers(zero(i), i))
j = produce!(Data.Integers(zero(i), i))
i,j
end
@test example(gen) isa Tuple{UInt8,UInt8}
@check function in_check(t=gen)
i = Data.produce!(Data.Integers(minmax(t...)...))
i = produce!(Data.Integers(minmax(t...)...))
t isa Tuple{UInt8,UInt8} && i isa UInt8
end
end
Expand Down

0 comments on commit 2988f55

Please sign in to comment.