Skip to content

Commit e01e0de

Browse files
committed
save changes (init)
1 parent 0807b15 commit e01e0de

28 files changed

+182
-225
lines changed

.github/workflows/CI.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ jobs:
1414
strategy:
1515
matrix:
1616
group:
17-
- Core
17+
- ReactionSystem
18+
- DSL
19+
- CompositionalModelling
20+
- Miscellaneous
21+
- NetworkAnalysis
22+
- Simulation
23+
- Upstream
24+
- Spatial
25+
- Visualisation
26+
- Extensions
1827
version:
1928
- '1.10.2'
2029
steps:

test/dsl/dsl_basics.jl renamed to test/dsl/dsl_advanced_model_construction.jl

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ t = default_t()
1010

1111
### Naming Tests ###
1212

13-
# Test that the correct name is generated.
13+
# Basic name test.
14+
let
15+
rn = @reaction_network SIR1 begin
16+
k1, S + I --> 2I
17+
k2, I --> R
18+
end
19+
@test nameof(rn) == :SIR1
20+
end
21+
22+
# Advanced name tests.
1423
let
1524
@parameters k
1625
@species A(t)
@@ -323,58 +332,6 @@ let
323332
@test length(equations(osys2)) == 2
324333
end
325334

326-
# Test @variables in DSL.
327-
let
328-
rn = @reaction_network tester begin
329-
@parameters k1
330-
@variables V1(t) V2(t) V3(t)
331-
@species B1(t) B2(t)
332-
(k1*k2 + V3), V1*A + 2*B1 --> V2*C + B2
333-
end
334-
335-
@parameters k1 k2
336-
@variables V1(t) V2(t) V3(t)
337-
@species A(t) B1(t) B2(t) C(t)
338-
rx = Reaction(k1*k2 + V3, [A, B1], [C, B2], [V1, 2], [V2, 1])
339-
@named tester = ReactionSystem([rx], t)
340-
@test tester == rn
341-
342-
sts = (A, B1, B2, C, V1, V2, V3)
343-
spcs = (A, B1, B2, C)
344-
@test issetequal(unknowns(rn), sts)
345-
@test issetequal(species(rn), spcs)
346-
347-
@test_throws ArgumentError begin
348-
rn = @reaction_network begin
349-
@variables K
350-
k, K*A --> B
351-
end
352-
end
353-
end
354-
355-
# Test ivs in DSL.
356-
let
357-
rn = @reaction_network ivstest begin
358-
@ivs s x
359-
@parameters k2
360-
@variables D(x) E(s) F(s,x)
361-
@species A(s,x) B(s) C(x)
362-
k*k2*D, E*A +B --> F*C + C2
363-
end
364-
365-
@parameters k k2
366-
@variables s x D(x) E(s) F(s,x)
367-
@species A(s,x) B(s) C(x) C2(s,x)
368-
rx = Reaction(k*k2*D, [A, B], [C, C2], [E, 1], [F, 1])
369-
@named ivstest = ReactionSystem([rx], s; spatial_ivs = [x])
370-
371-
@test ivstest == rn
372-
@test issetequal(unknowns(rn), [D, E, F, A, B, C, C2])
373-
@test issetequal(species(rn), [A, B, C, C2])
374-
@test isequal(ModelingToolkit.get_iv(rn), s)
375-
@test issetequal(Catalyst.get_sivs(rn), [x])
376-
end
377-
378335
# Array variables test.
379336
let
380337
rn = @reaction_network arrtest begin

test/dsl/dsl_model_construction.jl renamed to test/dsl/dsl_basic_model_construction.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,3 @@ let
435435
@test_throws LoadError @eval @reaction k, 0 --> im
436436
@test_throws LoadError @eval @reaction k, 0 --> nothing
437437
end
438-
439-
440-
### Other Tests ###
441-
442-
# Test names work.
443-
let
444-
rn = @reaction_network SIR1 begin
445-
k1, S + I --> 2I
446-
k2, I --> R
447-
end
448-
@test nameof(rn) == :SIR1
449-
end

test/dsl/dsl_options.jl

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ seed = rand(rng, 1:100)
1414
# Sets the default `t` to use.
1515
t = default_t()
1616

17-
### Tests `@parameters` and `@species` Options ###
17+
### Tests `@parameters`, `@species`, and `@variables` Options ###
1818

1919
# Test creating networks with/without options.
2020
let
@@ -394,6 +394,61 @@ let
394394
@test !ModelingToolkit.hasdescription(unwrap(rn.k5))
395395
end
396396

397+
# Test @variables in DSL.
398+
let
399+
rn = @reaction_network tester begin
400+
@parameters k1
401+
@variables V1(t) V2(t) V3(t)
402+
@species B1(t) B2(t)
403+
(k1*k2 + V3), V1*A + 2*B1 --> V2*C + B2
404+
end
405+
406+
@parameters k1 k2
407+
@variables V1(t) V2(t) V3(t)
408+
@species A(t) B1(t) B2(t) C(t)
409+
rx = Reaction(k1*k2 + V3, [A, B1], [C, B2], [V1, 2], [V2, 1])
410+
@named tester = ReactionSystem([rx], t)
411+
@test tester == rn
412+
413+
sts = (A, B1, B2, C, V1, V2, V3)
414+
spcs = (A, B1, B2, C)
415+
@test issetequal(unknowns(rn), sts)
416+
@test issetequal(species(rn), spcs)
417+
418+
@test_throws ArgumentError begin
419+
rn = @reaction_network begin
420+
@variables K
421+
k, K*A --> B
422+
end
423+
end
424+
end
425+
426+
### Test independent variable designation ###
427+
428+
# Test ivs in DSL.
429+
let
430+
rn = @reaction_network ivstest begin
431+
@ivs s x
432+
@parameters k2
433+
@variables D(x) E(s) F(s,x)
434+
@species A(s,x) B(s) C(x)
435+
k*k2*D, E*A +B --> F*C + C2
436+
end
437+
438+
@parameters k k2
439+
@variables s x D(x) E(s) F(s,x)
440+
@species A(s,x) B(s) C(x) C2(s,x)
441+
rx = Reaction(k*k2*D, [A, B], [C, C2], [E, 1], [F, 1])
442+
@named ivstest = ReactionSystem([rx], s; spatial_ivs = [x])
443+
444+
@test ivstest == rn
445+
@test issetequal(unknowns(rn), [D, E, F, A, B, C, C2])
446+
@test issetequal(species(rn), [A, B, C, C2])
447+
@test isequal(ModelingToolkit.get_iv(rn), s)
448+
@test issetequal(Catalyst.get_sivs(rn), [x])
449+
end
450+
451+
397452
### Observables ###
398453

399454
# Test basic functionality.
@@ -687,7 +742,7 @@ let
687742
end
688743

689744

690-
### Coupled CRN/Equations Models ###
745+
### Test `@equations` for Coupled CRN/Equations Models ###
691746

692747
# Checks creation of basic network.
693748
# Check indexing of output solution.

test/model_simulation/u0_n_parameter_inputs.jl

Lines changed: 0 additions & 74 deletions
This file was deleted.

test/programmatic_model_creation/programmatic_model_expansion.jl

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)