Skip to content

Commit 9894249

Browse files
Update old C call tests, remove old tests
1 parent 23a53d3 commit 9894249

File tree

1 file changed

+69
-71
lines changed

1 file changed

+69
-71
lines changed

test/runtests.jl

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@ end
8686
params = (214.6561105573191, 76.6251447, 200.0, 2.0, 0.727)
8787
current_store, rain, d, d2, alpha = params
8888

89-
interim_results = [0.0, 0.0, 0.0]
90-
@ccall IHACRES.calc_ft_interim_cmd(interim_results::Ptr{Cdouble},
91-
current_store::Cdouble,
92-
rain::Cdouble,
93-
d::Cdouble,
94-
d2::Cdouble,
95-
alpha::Cdouble)::Cvoid
96-
97-
(mf, e_rainfall, recharge) = interim_results
89+
(mf, e_rainfall, recharge) = calc_ft_interim_cmd(
90+
current_store,
91+
rain,
92+
d,
93+
d2,
94+
alpha
95+
)
9896

9997
@test !isnan(mf)
10098
@test !isnan(e_rainfall)
@@ -108,73 +106,73 @@ end
108106
recharge = 3.84930005080411E-06
109107
rain = 0.0000188
110108

111-
n_cmd = @ccall IHACRES.calc_cmd(cmd::Cdouble, rain::Cdouble, et::Cdouble, e_rain::Cdouble, recharge::Cdouble)::Float64
109+
n_cmd = IHACRES.calc_cmd(cmd, rain, et, e_rain, recharge)
112110

113111
@test isapprox(n_cmd, 106.22, atol=0.001)
114112
end
115113

116114

117-
@testset "IHACRES calculations" begin
118-
area = 1985.73
119-
a = 54.352
120-
b = 0.187
121-
e_rain = 3.421537294474909e-6
122-
recharge = 3.2121031313153022e-6
123-
124-
prev_quick = 100.0
125-
prev_slow = 100.0
126-
127-
flow_results = [0.0, 0.0, 0.0]
128-
@ccall IHACRES.calc_ft_flows(
129-
flow_results::Ptr{Cdouble},
130-
prev_quick::Cdouble,
131-
prev_slow::Cdouble,
132-
e_rain::Cdouble,
133-
recharge::Cdouble,
134-
area::Cdouble,
135-
a::Cdouble,
136-
b::Cdouble
137-
)::Cvoid
138-
139-
quickflow = (prev_quick + (e_rain * area))
140-
α = exp(-a)
141-
quickflow = α * quickflow
142-
143-
@test flow_results[1] == quickflow
144-
145-
slow_store = prev_slow + (recharge * area)
146-
α = exp(-b)
147-
slow_store = α * slow_store
148-
@test flow_results[2] == slow_store
149-
150-
e_rain = 0.0
151-
recharge = 0.0
152-
153-
prev_quick = 3.3317177943791187
154-
prev_slow = 144.32012122323678
155-
156-
flow_results = [0.0, 0.0, 0.0]
157-
@ccall IHACRES.calc_ft_flows(
158-
flow_results::Ptr{Cdouble},
159-
prev_quick::Cdouble,
160-
prev_slow::Cdouble,
161-
e_rain::Cdouble,
162-
recharge::Cdouble,
163-
area::Cdouble,
164-
a::Cdouble,
165-
b::Cdouble
166-
)::Cvoid
167-
168-
quickflow = (prev_quick + (e_rain * area))
169-
α = exp(-a)
170-
@test flow_results[1] ==* quickflow)
171-
172-
slow_store = prev_slow + (recharge * area)
173-
α = exp(-b)
174-
β = (1.0 - α) * slow_store
175-
slow_store = α * slow_store
176-
@test flow_results[2] == slow_store
177-
end
115+
# @testset "IHACRES calculations" begin
116+
# area = 1985.73
117+
# a = 54.352
118+
# b = 0.187
119+
# e_rain = 3.421537294474909e-6
120+
# recharge = 3.2121031313153022e-6
121+
122+
# prev_quick = 100.0
123+
# prev_slow = 100.0
124+
125+
# flow_results = [0.0, 0.0, 0.0]
126+
# @ccall IHACRES.calc_ft_flows(
127+
# flow_results::Ptr{Cdouble},
128+
# prev_quick::Cdouble,
129+
# prev_slow::Cdouble,
130+
# e_rain::Cdouble,
131+
# recharge::Cdouble,
132+
# area::Cdouble,
133+
# a::Cdouble,
134+
# b::Cdouble
135+
# )::Cvoid
136+
137+
# quickflow = (prev_quick + (e_rain * area))
138+
# α = exp(-a)
139+
# quickflow = α * quickflow
140+
141+
# @test flow_results[1] == quickflow
142+
143+
# slow_store = prev_slow + (recharge * area)
144+
# α = exp(-b)
145+
# slow_store = α * slow_store
146+
# @test flow_results[2] == slow_store
147+
148+
# e_rain = 0.0
149+
# recharge = 0.0
150+
151+
# prev_quick = 3.3317177943791187
152+
# prev_slow = 144.32012122323678
153+
154+
# flow_results = [0.0, 0.0, 0.0]
155+
# @ccall IHACRES.calc_ft_flows(
156+
# flow_results::Ptr{Cdouble},
157+
# prev_quick::Cdouble,
158+
# prev_slow::Cdouble,
159+
# e_rain::Cdouble,
160+
# recharge::Cdouble,
161+
# area::Cdouble,
162+
# a::Cdouble,
163+
# b::Cdouble
164+
# )::Cvoid
165+
166+
# quickflow = (prev_quick + (e_rain * area))
167+
# α = exp(-a)
168+
# @test flow_results[1] == (α * quickflow)
169+
170+
# slow_store = prev_slow + (recharge * area)
171+
# α = exp(-b)
172+
# β = (1.0 - α) * slow_store
173+
# slow_store = α * slow_store
174+
# @test flow_results[2] == slow_store
175+
# end
178176

179177
include("test_metrics.jl")
180178
include("test_data_op.jl")

0 commit comments

Comments
 (0)