Skip to content

Commit 67f1f73

Browse files
committed
Add type stability tests for new StructArray stuff
1 parent 2426642 commit 67f1f73

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

test/runtests.jl

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,75 @@ end
815815

816816
@test checkstability()
817817

818+
function get_section_r()
819+
radii = rand(10)
820+
chord = rand(length(radii), 2)
821+
theta = rand(length(radii), 1, 3)
822+
af = alpha->(1.0, 1.0)
823+
sections = Section.(radii, chord, theta, af)
824+
return sections.r
825+
end
826+
function test_section_type_stability()
827+
try
828+
@inferred Array{Float64, 3} get_section_r()
829+
return true
830+
catch err
831+
println(err)
832+
return false
833+
end
834+
end
835+
@test test_section_type_stability()
836+
837+
function get_operating_point_rho()
838+
Vx = rand(10)
839+
Vy = rand(10, 2)
840+
rho = rand(10, 1, 3)
841+
pitch = rand(10, 2, 3)
842+
mu = rand(1, 2, 3)
843+
asound = rand(10, 2, 1)
844+
ops = OperatingPoint.(Vx, Vy, rho, pitch, mu, asound)
845+
return ops.rho
846+
end
847+
function test_operating_point_type_stability()
848+
try
849+
@inferred Array{Float64, 3} get_operating_point_rho()
850+
return true
851+
catch err
852+
println(err)
853+
return false
854+
end
855+
end
856+
@test test_operating_point_type_stability()
857+
858+
function get_outputs_cl()
859+
Np = rand(10, 2)
860+
Tp = rand(10, 1, 3)
861+
a = rand(10, 2, 3)
862+
ap = rand(1, 2, 3)
863+
u = rand(10, 2, 1)
864+
v = rand(10, 1, 3)
865+
phi = rand(10, 2, 3)
866+
alpha = rand(10, 1, 1)
867+
W = rand(10, 2, 1)
868+
cl = rand(10, 1, 3)
869+
cd = rand(10, 2, 3)
870+
cn = rand(10, 1, 1)
871+
ct = rand(10, 2, 3)
872+
F = rand(10, 1, 1)
873+
G = rand(10, 1, 3)
874+
outs = Outputs.(Np, Tp, a, ap, u, v, phi, alpha, W, cl, cd, cn, ct, F, G)
875+
return outs.cl
876+
end
877+
function test_outputs_type_stability()
878+
try
879+
@inferred Array{Float64, 3} get_outputs_cl()
880+
return true
881+
catch err
882+
println(err)
883+
return false
884+
end
885+
end
886+
@test test_outputs_type_stability()
818887

819888
end
820889

0 commit comments

Comments
 (0)