Skip to content

Commit d8779e3

Browse files
committed
Fix allocation test
1 parent db75485 commit d8779e3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ StatsAPI = "1.2"
3333
julia = "1.10"
3434

3535
[extras]
36-
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3736
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
3837
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
3938
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
4039
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
4140
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4241

4342
[targets]
44-
test = ["BenchmarkTools", "Dates", "DelimitedFiles", "OffsetArrays", "StableRNGs", "Test"]
43+
test = ["Dates", "DelimitedFiles", "OffsetArrays", "StableRNGs", "Test"]

test/scalarstats.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using StatsBase
22
using Test
33
using DelimitedFiles
44
using Statistics
5-
using BenchmarkTools: @benchmark
65

76
##### Location
87

@@ -221,8 +220,10 @@ x = sort!(vcat([5:-1:i for i in 1:5]...))
221220
@test_throws ArgumentError mad(Int[], normalize = true)
222221
@test mad(Iterators.repeated(4, 10)) == 0
223222
@test mad(Integer[1,2,3,4]) === mad(1:4)
223+
mad_allocs(itr) = @allocations(mad(itr))
224224
let itr = (i for i in 1:10000)
225-
@test (@benchmark mad($itr)).allocs < 200
225+
mad_allocs(itr)
226+
@test mad_allocs(itr) < 50
226227
end
227228

228229
# Issue 197

0 commit comments

Comments
 (0)