Permalink
Browse files

TEST: clean up tests so they pass on 0.4 and 0.5

  • Loading branch information...
1 parent f9f161b commit d0fc0402962b997935bca6af212fb83b6368250d @sglyon sglyon committed Nov 15, 2016
Showing with 22 additions and 9 deletions.
  1. +4 −2 test/test_mc_tools.jl
  2. +18 −7 test/test_quad.jl
@@ -516,7 +516,6 @@ end
end
@test done(mcis, (1, 50))
@test length(mcis) == 50
- @test Base.iteratorsize(mcis) == Base.HasLength()
@test eltype(mcis) == Int
mcs = MCSimulator(mc, 50, 1)
@@ -534,9 +533,12 @@ end
end
@test done(mcs, (1, 50))
@test length(mcs) == 50
- @test Base.iteratorsize(mcs) == Base.HasLength()
@test eltype(mcs) == Float64
+ if isdefined(Base, :iteratorsize)
+ @test Base.iteratorsize(mcs) == Base.HasLength()
+ @test Base.iteratorsize(mcis) == Base.HasLength()
+ end
end
end # testset
View
@@ -50,13 +50,24 @@ x_gamm_3, w_gamm_3 = qnwgamma(n_3, b_3, ones(3))
@testset "Testing method resolution" begin
for f in qnwfuncs
- m1 = @inferred f(11, 1, 3)
- m2 = @inferred f([11], 1, 3)
- m3 = @inferred f(11, [1], 3)
- m4 = @inferred f(11, 1, [3])
- m5 = @inferred f([11], [1], 3)
- m6 = @inferred f([11], 1, [3])
- m7 = @inferred f([11], [1], [3])
+ if VERSION >= v"0.5-"
+ m1 = @inferred f(11, 1, 3)
+ m2 = @inferred f([11], 1, 3)
+ m3 = @inferred f(11, [1], 3)
+ m4 = @inferred f(11, 1, [3])
+ m5 = @inferred f([11], [1], 3)
+ m6 = @inferred f([11], 1, [3])
+ m7 = @inferred f([11], [1], [3])
+ else
+ # type inference doesn't get this right on 0.4...
+ m1 = f(11, 1, 3)
+ m2 = f([11], 1, 3)
+ m3 = f(11, [1], 3)
+ m4 = f(11, 1, [3])
+ m5 = f([11], [1], 3)
+ m6 = f([11], 1, [3])
+ m7 = f([11], [1], [3])
+ end
# Stack nodes/weights in columns
@test isapprox([m1[1] m1[2]], [m2[1] m2[2]])

0 comments on commit d0fc040

Please sign in to comment.