Skip to content

Commit 8f7a7e8

Browse files
committed
Add tests
1 parent 2705f6a commit 8f7a7e8

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

test/wing_geometry/test_wing_geometry.jl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,56 @@ end
9292
@test all(diff(cleaned_data[2]) .> 0) # delta still monotonic
9393
end
9494

95+
@testset "Matrix polar interpolation" begin
96+
alpha = [-0.2, 0.0, 0.2]
97+
delta = [-0.1, 0.1]
98+
99+
cl_left = [1.0 2.0; 3.0 4.0; 5.0 6.0]
100+
cd_left = [0.1 0.2; 0.3 0.4; 0.5 0.6]
101+
cm_left = [-0.1 -0.2; -0.3 -0.4; -0.5 -0.6]
102+
103+
cl_right = cl_left .+ 6.0
104+
cd_right = cd_left .+ 0.6
105+
cm_right = cm_left .- 0.6
106+
107+
polar_left = (alpha, delta, cl_left, cd_left, cm_left)
108+
polar_right = (copy(alpha), copy(delta), cl_right, cd_right, cm_right)
109+
110+
result = VortexStepMethod.calculate_new_aero_data(
111+
(POLAR_MATRICES, POLAR_MATRICES),
112+
(polar_left, polar_right),
113+
1,
114+
0.25,
115+
0.75,
116+
)
117+
118+
@test result[1] === alpha
119+
@test result[2] === delta
120+
@test result[3] cl_left .* 0.25 .+ cl_right .* 0.75
121+
@test result[4] cd_left .* 0.25 .+ cd_right .* 0.75
122+
@test result[5] cm_left .* 0.25 .+ cm_right .* 0.75
123+
124+
bad_alpha_right = [-0.2, 0.05, 0.2]
125+
@test_throws ArgumentError("Alpha steps must be identical.") \
126+
VortexStepMethod.calculate_new_aero_data(
127+
(POLAR_MATRICES, POLAR_MATRICES),
128+
(polar_left, (bad_alpha_right, delta, cl_right, cd_right, cm_right)),
129+
1,
130+
0.5,
131+
0.5,
132+
)
133+
134+
bad_delta_right = [-0.1, 0.15]
135+
@test_throws ArgumentError("Delta steps must be identical.") \
136+
VortexStepMethod.calculate_new_aero_data(
137+
(POLAR_MATRICES, POLAR_MATRICES),
138+
(polar_left, (copy(alpha), bad_delta_right, cl_right, cd_right, cm_right)),
139+
1,
140+
0.5,
141+
0.5,
142+
)
143+
end
144+
95145
@testset "Robustness left to right" begin
96146
example_wing = Wing(10)
97147
# Test correct order

0 commit comments

Comments
 (0)