Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Jul 21, 2024
1 parent 7e53155 commit a119ef4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/reactionsystem_core/coupled_equation_crn_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ let
# Equation with variable using non-declared independent variable.
@test_throws Exception ReactionSystem([
Reaction(p1, [S1], [S2]),
U1 ~ S1 + p2
E(U1) ~ S1 + p2
], t; name = :rs)

# Differential with respect to non-declared independent variable.
Expand Down
24 changes: 24 additions & 0 deletions test/reactionsystem_core/reactionsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,30 @@ let
@test_throws Exception convert(NonlinearSystem, nc)
end

# Checks that the same name cannot be used for two different of parameters/species/variables.
let
# Stores a parameter, a species, and a variable (with identical names) in different variables.
x_p = let
only(@parameters x)
end
x_sp = let
only(@species x(t))
end
x_v = let
only(@variables x(t))
end

# Checks that creating systems with different in combination produces errors.
# Currently broken on MTK, potentially fix in Catalyst once sorted out there (https://github.com/SciML/ModelingToolkit.jl/issues/2883).
@parameters d
@species X(t)
rx = Reaction(d, [X], [])
@test_broken false # (not sure how to mark a `@test_throws` as broken)
# @test_throws rs1 = ReactionSystem([rx], t, [X, x_sp,], [d, x_p]; name = :rs)
# @test_throws rs2 = ReactionSystem([rx], t, [X, X, x_v], [d, x_p]; name = :rs)
# @test_throws rs2 = ReactionSystem([rx], t, [X, x_sp, x_v], [d]; name = :rs)
end

### Other Tests ###

# Test for https://github.com/SciML/ModelingToolkit.jl/issues/436.
Expand Down

0 comments on commit a119ef4

Please sign in to comment.