diff --git a/Project.toml b/Project.toml index cdc4ae1c..a1c5fc74 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Chairmarks" uuid = "0ca39b1e-fe0b-4e98-acfc-b1656634c4de" authors = ["Lilith Orion Hafner and contributors"] -version = "0.2.0" +version = "0.2.1" [deps] Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" diff --git a/src/benchmarking.jl b/src/benchmarking.jl index 8be37cdf..065dc679 100644 --- a/src/benchmarking.jl +++ b/src/benchmarking.jl @@ -12,7 +12,7 @@ maybecall(::Nothing, x::Tuple{}) = x maybecall(f, x::Tuple{Any}) = (f(only(x)),) maybecall(f::Function, ::Tuple{}) = (f(),) maybecall(x, ::Tuple{}) = (x,) -function benchmark(init, setup, f, teardown; evals::Union{Int, Nothing}=nothing, samples::Union{Int, Nothing}=nothing, seconds::Union{Float64, Nothing}=samples===nothing ? .1 : 1, map=default_map, reduction=default_reduction) +function benchmark(init, setup, f, teardown; evals::Union{Int, Nothing}=nothing, samples::Union{Int, Nothing}=nothing, seconds::Union{Real, Nothing}=samples===nothing ? .1 : 1, map=default_map, reduction=default_reduction) @nospecialize samples !== nothing && evals === nothing && throw(ArgumentError("Sorry, we don't support specifying samples but not evals")) samples === seconds === nothing && throw(ArgumentError("Must specify either samples or seconds")) diff --git a/test/runtests.jl b/test/runtests.jl index b10d9692..163c64ba 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -35,6 +35,11 @@ using Statistics @test Chairmarks.median([1, 2, 3]) === 2.0 @test Chairmarks.median((rand(1:3) for _ in 1:30 for _ in 1:30)) === 2.0 end + + @testset "seconds kw" begin + @b 1+1 seconds=1 + @b 1+1 seconds=.001 + end end @testset "Precision" begin