From 2988f553380f7d6db363bf917c9cd16d60d4519b Mon Sep 17 00:00:00 2001 From: Sukera Date: Mon, 4 Mar 2024 22:10:06 +0100 Subject: [PATCH] Clean up uses of `produce!` and exported API These were somehow missed in the refactor. While we're at it, also clean up the exported API from the main module. --- src/Supposition.jl | 5 ++++- src/api.jl | 2 +- src/data.jl | 2 +- test/runtests.jl | 7 ++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Supposition.jl b/src/Supposition.jl index 0d0457b..daee827 100644 --- a/src/Supposition.jl +++ b/src/Supposition.jl @@ -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 @@ -25,6 +25,9 @@ include("api.jl") include("history.jl") include("testset.jl") +using .Data: produce! +export produce! + """ DEFAULT_CONFIG diff --git a/src/api.jl b/src/api.jl index 31dbc18..4282459 100644 --- a/src/api.jl +++ b/src/api.jl @@ -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) diff --git a/src/data.jl b/src/data.jl index d8c08c2..d4b6249 100644 --- a/src/data.jl +++ b/src/data.jl @@ -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 """ diff --git a/test/runtests.jl b/test/runtests.jl index 5e29c1c..f15cc68 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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