You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.4 KiB
Julia
54 lines
1.4 KiB
Julia
using Test,Flux
|
|
|
|
include("../src/Orbits.jl")
|
|
using .Orbits
|
|
|
|
|
|
|
|
#=
|
|
Structure:
|
|
|
|
This is broken into three parts
|
|
- The test_interfaces module contains various tools used in testing
|
|
- The test_routines includes functions that setup, run, and teardown tests
|
|
- Everything else is a set of tests using the standard testing tools in Julia
|
|
=#
|
|
@testset "Overall" verbose=true begin
|
|
@testset "TupleDuplicator" verbose=true begin
|
|
#Check if tuple duplicator duplicates something
|
|
td2 = Orbits.TupleDuplicator(2)
|
|
@test typeof(td2) <: Orbits.TupleDuplicator
|
|
|
|
@test td2(([1,2],[3])) == (([1,2],[3]),([1,2],[3]))
|
|
|
|
st = State([1.0,2],[3])
|
|
@test td2((st.stocks,st.debris)) == (([1.0,2],[3]),([1.0,2],[3]))
|
|
|
|
@test td2(state_to_tuple(st)) == (([1.0,2],[3]),([1.0,2],[3]))
|
|
|
|
@test td2(st) == ((st.stocks,st.debris),(st.stocks,st.debris))
|
|
end
|
|
|
|
@testset "BranchGenerator" verbose=true begin
|
|
st = State([1.0,2],[3])
|
|
tp = state_to_tuple(st)
|
|
bg = BranchGenerator(2)
|
|
|
|
branch = Flux.Parallel(vcat, Dense(2,1),Dense(1,1))
|
|
|
|
branched = bg(branch,vcat)
|
|
|
|
#type tests
|
|
@test typeof(branch(tp)) <: Array{Float32}
|
|
|
|
@test_broken typeof(branched[2](tp)) <: Array{Float32}
|
|
#ISSUE: what am I really looking for here?
|
|
|
|
#Check behaviors of the
|
|
@test branched[1](st) == state_to_tuple(st) #Evaluation is of the wrong approach
|
|
|
|
|
|
|
|
end #branch generator
|
|
|
|
end #overall testset |