Skip to content

Commit 94b5775

Browse files
Merge pull request #3847 from ChrisRackauckas/remove-outdated-version-checks
Remove outdated Julia version checks from tests
2 parents 2dbb170 + 390c7cf commit 94b5775

File tree

3 files changed

+49
-55
lines changed

3 files changed

+49
-55
lines changed

test/clock.jl

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -298,44 +298,42 @@ eqs = [yd ~ Sample(dt)(y)
298298
ss = mtkcompile(cl)
299299
ss_nosplit = mtkcompile(cl; split = false)
300300

301-
if VERSION >= v"1.7"
302-
prob = ODEProblem(ss, [x => 0.0, kp => 1.0], (0.0, 1.0))
303-
prob_nosplit = ODEProblem(ss_nosplit, [x => 0.0, kp => 1.0], (0.0, 1.0))
304-
sol = solve(prob, Tsit5(), kwargshandle = KeywordArgSilent)
305-
sol_nosplit = solve(prob_nosplit, Tsit5(), kwargshandle = KeywordArgSilent)
306-
307-
function foo!(dx, x, p, t)
308-
kp, ud1, ud2 = p
309-
dx[1] = -x[1] + ud1 + ud2
310-
end
301+
prob = ODEProblem(ss, [x => 0.0, kp => 1.0], (0.0, 1.0))
302+
prob_nosplit = ODEProblem(ss_nosplit, [x => 0.0, kp => 1.0], (0.0, 1.0))
303+
sol = solve(prob, Tsit5(), kwargshandle = KeywordArgSilent)
304+
sol_nosplit = solve(prob_nosplit, Tsit5(), kwargshandle = KeywordArgSilent)
311305

312-
function affect1!(integrator)
313-
kp = integrator.p[1]
314-
y = integrator.u[1]
315-
r = 1.0
316-
ud1 = kp * (r - y)
317-
integrator.p[2] = ud1
318-
nothing
319-
end
320-
function affect2!(integrator)
321-
kp = integrator.p[1]
322-
y = integrator.u[1]
323-
r = 1.0
324-
ud2 = kp * (r - y)
325-
integrator.p[3] = ud2
326-
nothing
327-
end
328-
cb1 = PeriodicCallback(affect1!, dt; final_affect = true, initial_affect = true)
329-
cb2 = PeriodicCallback(affect2!, dt2; final_affect = true, initial_affect = true)
330-
cb = CallbackSet(cb1, cb2)
331-
# kp ud1 ud2
332-
prob = ODEProblem(foo!, [0.0], (0.0, 1.0), [1.0, 1.0, 1.0], callback = cb)
333-
sol2 = solve(prob, Tsit5())
334-
335-
@test sol.usol2.u atol=1e-6
336-
@test sol_nosplit.usol2.u atol=1e-6
306+
function foo!(dx, x, p, t)
307+
kp, ud1, ud2 = p
308+
dx[1] = -x[1] + ud1 + ud2
337309
end
338310

311+
function affect1!(integrator)
312+
kp = integrator.p[1]
313+
y = integrator.u[1]
314+
r = 1.0
315+
ud1 = kp * (r - y)
316+
integrator.p[2] = ud1
317+
nothing
318+
end
319+
function affect2!(integrator)
320+
kp = integrator.p[1]
321+
y = integrator.u[1]
322+
r = 1.0
323+
ud2 = kp * (r - y)
324+
integrator.p[3] = ud2
325+
nothing
326+
end
327+
cb1 = PeriodicCallback(affect1!, dt; final_affect = true, initial_affect = true)
328+
cb2 = PeriodicCallback(affect2!, dt2; final_affect = true, initial_affect = true)
329+
cb = CallbackSet(cb1, cb2)
330+
# kp ud1 ud2
331+
prob = ODEProblem(foo!, [0.0], (0.0, 1.0), [1.0, 1.0, 1.0], callback = cb)
332+
sol2 = solve(prob, Tsit5())
333+
334+
@test sol.usol2.u atol=1e-6
335+
@test sol_nosplit.usol2.u atol=1e-6
336+
339337
##
340338
@info "Testing hybrid system with components"
341339
using ModelingToolkitStandardLibrary.Blocks

test/direct.jl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,20 @@ kwargs = (; name = 3)
240240
@test cool_name[1] == (42,)
241241
@test collect(cool_name[2]) == [:name => 3]
242242

243-
if VERSION >= v"1.5"
244-
name = 3
245-
@named cool_name = foo(42; name)
246-
@test cool_name[1] == (42,)
247-
@test collect(cool_name[2]) == [:name => name]
248-
@named cool_name = foo(; name)
249-
@test collect(cool_name) == [:name => name]
250-
251-
ff = 3
252-
@named cool_name = foo(42; ff)
253-
@test cool_name[1] == (42,)
254-
@test collect(cool_name[2]) == [pp; :ff => ff]
255-
256-
@named cool_name = foo(; ff)
257-
@test collect(cool_name) == [pp; :ff => ff]
258-
end
243+
name = 3
244+
@named cool_name = foo(42; name)
245+
@test cool_name[1] == (42,)
246+
@test collect(cool_name[2]) == [:name => name]
247+
@named cool_name = foo(; name)
248+
@test collect(cool_name) == [:name => name]
249+
250+
ff = 3
251+
@named cool_name = foo(42; ff)
252+
@test cool_name[1] == (42,)
253+
@test collect(cool_name[2]) == [pp; :ff => ff]
254+
255+
@named cool_name = foo(; ff)
256+
@test collect(cool_name) == [pp; :ff => ff]
259257

260258
foo(i; name) = (; i, name)
261259
@named goo[1:3] = foo(10)

test/input_output_handling.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
88
eqs = [D(xx) ~ some_input]
99
@named model = System(eqs, t)
1010
@test_throws ExtraVariablesSystemException mtkcompile(model)
11-
if VERSION >= v"1.8"
12-
err = "In particular, the unset input(s) are:\n some_input(t)"
13-
@test_throws err mtkcompile(model)
14-
end
11+
err = "In particular, the unset input(s) are:\n some_input(t)"
12+
@test_throws err mtkcompile(model)
1513

1614
# Test input handling
1715
@variables x(t) u(t) [input = true] v(t)[1:2] [input = true]

0 commit comments

Comments
 (0)