Skip to content

Commit d03c7c0

Browse files
Merge #102
102: Add QA tests on built integrators r=charleskawczynski a=charleskawczynski This PR adds some QA tests for the integrators that we build. Co-authored-by: Charles Kawczynski <[email protected]>
2 parents c324e34 + f42e821 commit d03c7c0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/integrator.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ClimaTimeSteppers, Test
22
import OrdinaryDiffEq
33

4+
include("integrator_utils.jl")
45
include("problems.jl")
56

67
@testset "integrator save times" begin
@@ -150,6 +151,7 @@ end
150151
((; saveat = save_dt, tstops = all_times), (; erase_sol = false), all_times),
151152
)
152153
integrator = init(deepcopy(prob), alg; dt, init_kwargs...)
154+
@test !@has_DataType_or_UnionAll(integrator)
153155
solve!(integrator)
154156
reinit!(integrator, u0′; t0 = t0′, tf = tf′, reinit_kwargs...)
155157
sol = solve!(integrator)

test/integrator_utils.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function has_DataType_or_UnionAll(obj, name, pc = ())
2+
for pn in propertynames(obj)
3+
prop = getproperty(obj, pn)
4+
pc_full = (pc..., ".", pn)
5+
pc_string = name*string(join(pc_full))
6+
if prop isa DataType
7+
@warn "$pc_string::$(typeof(prop)) is a DataType"
8+
return true
9+
elseif prop isa UnionAll
10+
@warn "$pc_string::$(typeof(prop)) is a UnionAll"
11+
return true
12+
else
13+
has_DataType_or_UnionAll(prop, name, pc_full)
14+
end
15+
end
16+
return false
17+
end
18+
macro has_DataType_or_UnionAll(obj)
19+
return :(has_DataType_or_UnionAll($(esc(obj)), $(string(obj))))
20+
end

0 commit comments

Comments
 (0)