-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,47 @@ | ||
@testset "moinput" begin | ||
x = [rand(5) for _ in 1:4] | ||
mgpi = MOInput(x, 3) | ||
|
||
@test length(mgpi) == 12 | ||
@test size(mgpi) == (12,) | ||
@test size(mgpi, 1) == 12 | ||
@test size(mgpi, 2) == 1 | ||
@test lastindex(mgpi) == 12 | ||
@test firstindex(mgpi) == 1 | ||
@test iterate(mgpi) == (mgpi[1], 1) | ||
@test iterate(mgpi, 2) == (mgpi[3], 3) | ||
@test_throws BoundsError mgpi[0] | ||
|
||
@test mgpi[2] == (x[2], 1) | ||
@test mgpi[5] == (x[1], 2) | ||
@test mgpi[7] == (x[3], 2) | ||
@test all([(x_, i) for i in 1:3 for x_ in x] .== mgpi) | ||
type_1 = AbstractVector{Tuple{Vector{Float64},Int}} | ||
type_2 = AbstractVector{Tuple{AbstractVector{Vector{Float64}},Int}} | ||
|
||
@testset "isotopicbyoutputs" begin | ||
ibo = MOInput(x, 3) | ||
|
||
@test ibo == KernelFunctions.MOInputIsotopicByOutputs(x, 3) | ||
|
||
@test isa(ibo, type_1) == true | ||
@test isa(ibo, type_2) == false | ||
|
||
@test length(ibo) == 12 | ||
@test size(ibo) == (12,) | ||
@test size(ibo, 1) == 12 | ||
@test size(ibo, 2) == 1 | ||
@test lastindex(ibo) == 12 | ||
@test firstindex(ibo) == 1 | ||
@test_throws BoundsError ibo[0] | ||
|
||
@test ibo[2] == (x[2], 1) | ||
@test ibo[5] == (x[1], 2) | ||
@test ibo[7] == (x[3], 2) | ||
@test all([(x_, i) for i in 1:3 for x_ in x] .== ibo) | ||
end | ||
|
||
@testset "isotopicbyfeatures" begin | ||
ibf = KernelFunctions.MOInputIsotopicByFeatures(x, 3) | ||
|
||
@test isa(ibf, type_1) == true | ||
@test isa(ibf, type_2) == false | ||
|
||
@test length(ibf) == 12 | ||
@test size(ibf) == (12,) | ||
@test size(ibf, 1) == 12 | ||
@test size(ibf, 2) == 1 | ||
@test lastindex(ibf) == 12 | ||
@test firstindex(ibf) == 1 | ||
@test_throws BoundsError ibf[0] | ||
|
||
@test ibf[2] == (x[1], 2) | ||
@test ibf[5] == (x[2], 2) | ||
@test ibf[7] == (x[3], 1) | ||
@test all([(x_, i) for x_ in x for i in 1:3] .== ibf) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters