Skip to content

Commit

Permalink
Julia 0.7 fixes (#112)
Browse files Browse the repository at this point in the history
* Added import of Statistics on appropriate versions

* Removed reference to IterativeEigensolvers

* Removed svds test to avoid a dependency on the Arpack package

* Added 0.7 to the Travis matrix
  • Loading branch information
Sean McBane authored and ararslan committed Jul 3, 2018
1 parent bbf8f54 commit 0067b5b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ os:
- osx
julia:
- 0.6
- 0.7
- nightly
notifications:
email: false
Expand Down
6 changes: 6 additions & 0 deletions src/BenchmarkTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ using Compat
using JSON
using Base.Iterators

if VERSION >= v"0.7.0-beta.85"
import Statistics: mean, median
else
import Base: mean, median
end

using Compat.Printf


Expand Down
4 changes: 2 additions & 2 deletions src/groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Base.filter(f, group::BenchmarkGroup) = filter!(f, copy(group))

Base.minimum(group::BenchmarkGroup) = mapvals(minimum, group)
Base.maximum(group::BenchmarkGroup) = mapvals(maximum, group)
Base.mean(group::BenchmarkGroup) = mapvals(mean, group)
Base.median(group::BenchmarkGroup) = mapvals(median, group)
mean(group::BenchmarkGroup) = mapvals(mean, group)
median(group::BenchmarkGroup) = mapvals(median, group)
Base.min(groups::BenchmarkGroup...) = mapvals(min, groups...)
Base.max(groups::BenchmarkGroup...) = mapvals(max, groups...)

Expand Down
4 changes: 2 additions & 2 deletions src/trials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function Base.maximum(trial::Trial)
return TrialEstimate(trial, trial.times[i], trial.gctimes[i])
end

Base.median(trial::Trial) = TrialEstimate(trial, median(trial.times), median(trial.gctimes))
Base.mean(trial::Trial) = TrialEstimate(trial, mean(trial.times), mean(trial.gctimes))
median(trial::Trial) = TrialEstimate(trial, median(trial.times), median(trial.gctimes))
mean(trial::Trial) = TrialEstimate(trial, mean(trial.times), mean(trial.gctimes))

Base.isless(a::TrialEstimate, b::TrialEstimate) = isless(time(a), time(b))

Expand Down
3 changes: 0 additions & 3 deletions test/ExecutionTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ using BenchmarkTools
using Compat
using Compat.Test

using Compat.IterativeEigensolvers

seteq(a, b) = length(a) == length(b) == length(intersect(a, b))

#########
Expand All @@ -26,7 +24,6 @@ for s in sizes
end

groups["special"]["macro"] = @benchmarkable @test(1 == 1)
groups["special"]["kwargs"] = @benchmarkable svds(rand(2, 2), nsv = 1)
groups["special"]["nothing"] = @benchmarkable nothing
groups["special"]["block"] = @benchmarkable begin rand(3) end
groups["special"]["comprehension"] = @benchmarkable [s^2 for s in sizes]
Expand Down
4 changes: 4 additions & 0 deletions test/GroupsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ using BenchmarkTools: TrialEstimate, Parameters
using Compat
using Compat.Test

if VERSION >= v"0.7.0-beta.85"
using Statistics
end

seteq(a, b) = length(a) == length(b) == length(intersect(a, b))

##################
Expand Down
4 changes: 4 additions & 0 deletions test/TrialsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ using BenchmarkTools
using Compat
using Compat.Test

if VERSION >= v"0.7.0-beta.85"
using Statistics
end

#########
# Trial #
#########
Expand Down

0 comments on commit 0067b5b

Please sign in to comment.