Skip to content

Commit 0929f7f

Browse files
committed
Additional tests using complicated systems
1 parent 2e30e28 commit 0929f7f

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

test/miscellaneous_tests/units.jl

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ let
6565
@test (@test_logs (:warn, ) match_mode=:any validate(bad_rs)) == false
6666
end
6767

68-
6968
# Checks that units work in the DSL.
7069
begin
7170
# Creates the model, while designating matching units.
@@ -147,3 +146,49 @@ begin
147146
end
148147
end
149148

149+
# Checks that units works for various non-trivial systems.
150+
let
151+
# Parametric rates (no units).
152+
@test_broken false # This yields a warning (and it shouldn't).
153+
rn = @reaction_network begin
154+
k1, 2X1 --> Z1
155+
k2, n2*X2 --> m2*Z2
156+
k3, n3*X3 + m3*Y3--> Z3
157+
end
158+
159+
# Parametric rates with units is not possible, since the unit depends on the parameter values.
160+
161+
# Non-constant rates (no units).
162+
@test_nowarn rn = @reaction_network begin
163+
k1*X1, 2X1 --> Z1
164+
mm(X2, v2, K2), X2 --> Z2
165+
hill(X3, v3, K3, n3), X3 + Y3--> Z3
166+
end
167+
168+
# Non-constant rates (units).
169+
@test_broken false # The below expression generates an error on compile. Really no idea why, have
170+
# managed to make a really small example of it, but not figured it out yet.
171+
# rn = @reaction_network begin
172+
# @ivs t [unit=u"s"]
173+
# @species begin
174+
# X1(t), [unit=u"m"]
175+
# Z1(t), [unit=u"m"]
176+
# X2(t), [unit=u"m"]
177+
# Z2(t), [unit=u"m"]
178+
# X3(t), [unit=u"m"]
179+
# Y3(t), [unit=u"m"]
180+
# Z3(t), [unit=u"m"]
181+
# end
182+
# @parameters begin
183+
# k1, [unit=u"m^(-4)/s"]
184+
# v2, [unit=u"m^(-4)/s"]
185+
# K2, [unit=u"m"]
186+
# v3, [unit=u"m^(-3)/s"]
187+
# K3, [unit=u"m"]
188+
# n3
189+
# end
190+
# k1*X1, 2X1 --> Z1
191+
# mm(X2, v, K), 3X2 --> Z2
192+
# hill(X3, v3, K3, n3), X3 + Y3--> Z3
193+
# end
194+
end

0 commit comments

Comments
 (0)