Skip to content

Commit 4068cd0

Browse files
committed
Added testing for interaction with units.
1 parent 22035d5 commit 4068cd0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/constants.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ModelingToolkit, OrdinaryDiffEq
1+
using ModelingToolkit, OrdinaryDiffEq, Unitful
22
using Test
33
MT = ModelingToolkit
44

@@ -22,3 +22,13 @@ simp = structural_simplify(sys);
2222
prob = ODEProblem(simp, [0, ], [0.0, 1.0], [])
2323
sol = solve(prob, Tsit5())
2424
@test sol[w][1] == 1
25+
26+
#Constant with units
27+
@constants β = 1 [unit = u"m/s"]
28+
MT.get_unit(β)
29+
@test MT.isconstant(β)
30+
@variables t [unit = u"s"] x(t) [unit = u"m"]
31+
D = Differential(t)
32+
eqs = [D(x) ~ β]
33+
sys = ODESystem(eqs,name=:sys)
34+

0 commit comments

Comments
 (0)