Skip to content

Commit a52e944

Browse files
committed
abandon old parameter access test in favour of weaker but robust tests
1 parent 625a255 commit a52e944

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/parameters.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@
8787
@test state.X hcat(Xs...)
8888
end
8989

90-
# Distributions 0.25.60 broke the tests marked broken below. Comment from @ablaom: I'd
91-
# say tests that dependend on implementation details of Distributions are not good
92-
# tests, and these should be replaced by more robust tests in the future. I'm guessing
93-
# these are really just integration tests. TODO: fix these tests
9490
@testset "Retrieve parameters" begin
9591
rng = StableRNG(1234)
9692
ranges = [r1, (r2, Uniform), (r3, d3), r4]
9793
state = PSO.initialize(rng, ranges, n)
9894
PSO.retrieve!(rng, state)
9995
params = state.parameters
100-
@test_broken params[1] == ["a", "a", "c"]
101-
@test params[2] [553, 250, 375]
102-
@test_broken @test params[3]
103-
[3.9372495283243105, 3.6569395920512977, 3.6354556967115146]
104-
@test_broken params[4] [-0.8067647f0, 0.4209916f0, 0.6736019f0]
96+
@test params[1] isa AbstractVector{<:AbstractString}
97+
@test params[2] isa AbstractVector{<:Integer}
98+
@test params[3] isa AbstractVector{<:AbstractFloat}
99+
@test params[4] isa AbstractVector{<:AbstractFloat}
100+
@test length(params[4]) == 3
101+
@test all(params) do p
102+
length(p) == n
103+
end
105104
end
106105
end

0 commit comments

Comments
 (0)