Skip to content

Commit

Permalink
Add esoteric arrays tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dingraha committed Jan 28, 2025
1 parent 0d4ab0c commit 10f7ad9
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
63 changes: 62 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -816,4 +816,65 @@ end
@test checkstability()


end
end

using OffsetArrays
using FillArrays

@testset "esoteric arrays" begin
radii = rand(10)
chord = rand(length(radii))
theta = rand(length(radii))
sections = Section.(radii, chord, theta, alpha->(1.0, 1.0))

Vx = rand(length(radii))
Vy = rand(length(radii))
rho = rand(length(radii))
pitch = rand(length(radii))
mu = rand(length(radii))
asound = rand(length(radii))
ops = OperatingPoint.(Vx, Vy, rho, pitch, mu, asound)

Np = rand(length(radii))
Tp = rand(length(radii))
a = rand(length(radii))
ap = rand(length(radii))
u = rand(length(radii))
v = rand(length(radii))
phi = rand(length(radii))
alpha = rand(length(radii))
W = rand(length(radii))
cl = rand(length(radii))
cd = rand(length(radii))
cn = rand(length(radii))
ct = rand(length(radii))
F = rand(length(radii))
G = rand(length(radii))
outs = Outputs.(Np, Tp, a, ap, u, v, phi, alpha, W, cl, cd, cn, ct, F, G)

@testset "OffsetArrays" begin
sections_oa = OffsetArray(sections, 0:length(sections)-1)
@test sections[1].r sections_oa[0].r

ops_oa = OffsetArray(ops, 0:length(ops)-1)
@test ops[1].Vx ops_oa[0].Vx

outs_oa = OffsetArray(outs, 0:length(outs)-1)
@test outs[1].Np outs_oa[0].Np
end

@testset "FillArrays" begin
sections_fill = Fill(sections[1], 3)
@test length(sections_fill) == 3
sections_fill[3].r sections[1].r

ops_fill = Fill(ops[1], 3)
@test length(ops_fill) == 3
ops_fill[3].Vx ops[1].Vx

outs_fill = Fill(outs[1], 3)
@test length(outs_fill) == 3
outs_fill[3].Np outs[1].Np
end

end

0 comments on commit 10f7ad9

Please sign in to comment.