Skip to content

Commit 21f7d6e

Browse files
committed
Merge branch 'master' of https://github.com/SciML/Catalyst.jl into network-analysis-touchup
2 parents 30cf870 + a309a9e commit 21f7d6e

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pages = Any[
4040
"Steady state analysis" => Any[
4141
"steady_state_functionality/homotopy_continuation.md",
4242
"steady_state_functionality/nonlinear_solve.md",
43-
#"steady_state_functionality/steady_state_stability_computation.md",
43+
# "steady_state_functionality/steady_state_stability_computation.md",
4444
"steady_state_functionality/bifurcation_diagrams.md",
4545
"steady_state_functionality/dynamical_systems.md"
4646
],

test/network_analysis/crn_theory.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ let
2727
@test_throws Exception Catalyst.iscomplexbalanced(rn, k)
2828
end
2929

30+
# Test that incomplete rate maps error.
31+
let
32+
rn = @reaction_network begin
33+
(k1, k2), C1 <--> C2
34+
(k3, k4), C2 <--> C3
35+
(k5, k6), C3 <--> C1
36+
end
37+
38+
incorrect_params = Dict(:k1 => 0.5)
39+
@test_throws ErrorException Catalyst.iscomplexbalanced(rn, incorrect_params)
40+
end
41+
3042
# Tests rate matrix computation for various input types.
3143
let
3244
# Declares network and its known rate matrix.
@@ -56,10 +68,24 @@ let
5668
rates_invalid = reshape(rate_vals, 1, 8)
5769

5870
# Tests that all input types generates the correct rate matrix.
71+
<<<<<<< HEAD
5972
@test Catalyst.adjacencymat(rn, rates_vec) == rate_mat
6073
@test Catalyst.adjacencymat(rn, rates_tup) == rate_mat
6174
@test Catalyst.adjacencymat(rn, rates_dict) == rate_mat
6275
@test_throws Exception Catalyst.adjacencymat(rn, rate_vals)
76+
=======
77+
Catalyst.ratematrix(rn, rate_vals) == rate_mat
78+
Catalyst.ratematrix(rn, rates_vec) == rate_mat
79+
Catalyst.ratematrix(rn, rates_tup) == rate_mat
80+
Catalyst.ratematrix(rn, rates_dict) == rate_mat
81+
82+
# Tests that throws error in rate matrix.
83+
incorrect_param_dict = Dict(:k1 => 1.0)
84+
85+
@test_throws ErrorException Catalyst.ratematrix(rn, 123)
86+
@test_throws ErrorException Catalyst.ratematrix(rn, incorrect_param_dict)
87+
88+
>>>>>>> a309a9e81f964703653d00de2918e77c40f6ba6a
6389
@test_throws Exception Catalyst.iscomplexbalanced(rn, rates_invalid)
6490

6591
# Test sparse matrix
@@ -94,6 +120,16 @@ let
94120
@test Catalyst.robustspecies(EnvZ_OmpR) == [6]
95121
end
96122

123+
let
124+
# Define a reaction network with bi-directional reactions
125+
non_deficient_network = @reaction_network begin
126+
(k1, k2), A <--> B
127+
(k3, k4), B <--> C
128+
end
129+
130+
# Test: Check that the error is raised for networks with deficiency != 1
131+
@test_throws ErrorException Catalyst.robustspecies(non_deficient_network)
132+
end
97133

98134
### Complex balance and reversibility tests ###
99135

test/reactionsystem_core/reactionsystem.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ end
107107
let
108108
@named rs2 = ReactionSystem(rxs, t)
109109
@test Catalyst.isequivalent(rs, rs2)
110+
111+
# Test with a type mismatch
112+
@test Catalyst.isequivalent(rs, "Not a ReactionSystem") == false
110113
end
111114

112115
# Defaults test.

0 commit comments

Comments
 (0)