Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test restructure and parallelisation #835

Merged
merged 12 commits into from
May 16, 2024
2 changes: 0 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ on:
pull_request:
branches:
- master
- Catalyst_version_14
push:
branches:
- master
- Catalyst_version_14
jobs:
test:
runs-on: ubuntu-latest
Expand Down
15 changes: 5 additions & 10 deletions test/reactionsystem_core/reactionsystem_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,9 @@ end

# Tests construction of empty reaction networks.
let
function unpacksys(sys)
get_eqs(sys), get_iv(sys), get_unknowns(sys), get_ps(sys), nameof(sys), get_systems(sys)
end

empty_network_1 = @reaction_network
eqs, iv, ps, name, systems = unpacksys(empty_network_1)
@test length(eqs) == 0
@test nameof(iv) == :t
@test length(get_unknowns(empty_network_1)) == 0
@test length(ps) == 0
empty_network = @reaction_network
@test length(equations(empty_network)) == 0
@test nameof(independent_variable(empty_network)) == :t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a deprecated function. More generally why have you dropped using the getters here? We need to test them too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didin't realise that the test was specific to using the get_eqs getter instead of the equations getters. Figured it was just about checking the content of the empty network. If this is and important part of the test, shouldn't we just use the full set?

Good point about independent_variable, I will revert that and the others.

@test length(unknowns(empty_network)) == 0
@test length(parameters(empty_network)) == 0
end
96 changes: 38 additions & 58 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,88 +12,68 @@ const GROUP = get(ENV, "GROUP", "All")

if GROUP == "All" || GROUP == "ModelCreation"
# Tests the `ReactionSystem` structure and its properties.
@testset "ReactionSystem" begin
@time @safetestset "Reaction Structure" begin include("reactionsystem_core/reaction_structure.jl") end
@time @safetestset "ReactionSystem Structure" begin include("reactionsystem_core/reactionsystem_structure.jl") end
@time @safetestset "Higher Order Reactions" begin include("reactionsystem_core/higher_order_reactions.jl") end
@time @safetestset "Symbolic Stoichiometry" begin include("reactionsystem_core/symbolic_stoichiometry.jl") end
@time @safetestset "Parameter Type Designation" begin include("reactionsystem_core/parameter_type_designation.jl") end
@time @safetestset "Custom CRN Functions" begin include("reactionsystem_core/custom_crn_functions.jl") end
# @time @safetestset "Coupled CRN/Equation Systems" begin include("reactionsystem_core/coupled_equation_crn_systems.jl") end
@time @safetestset "Events" begin include("reactionsystem_core/events.jl") end
end

@time @safetestset "Reaction Structure" begin include("reactionsystem_core/reaction_structure.jl") end
@time @safetestset "ReactionSystem Structure" begin include("reactionsystem_core/reactionsystem_structure.jl") end
@time @safetestset "Higher Order Reactions" begin include("reactionsystem_core/higher_order_reactions.jl") end
@time @safetestset "Symbolic Stoichiometry" begin include("reactionsystem_core/symbolic_stoichiometry.jl") end
@time @safetestset "Parameter Type Designation" begin include("reactionsystem_core/parameter_type_designation.jl") end
@time @safetestset "Custom CRN Functions" begin include("reactionsystem_core/custom_crn_functions.jl") end
# @time @safetestset "Coupled CRN/Equation Systems" begin include("reactionsystem_core/coupled_equation_crn_systems.jl") end
@time @safetestset "Events" begin include("reactionsystem_core/events.jl") end

# Tests model creation via the @reaction_network DSL.
@testset "DSL" begin
@time @safetestset "DSL Basic Model Construction" begin include("dsl/dsl_basic_model_construction.jl") end
@time @safetestset "DSL Advanced Model Construction" begin include("dsl/dsl_advanced_model_construction.jl") end
@time @safetestset "DSL Options" begin include("dsl/dsl_options.jl") end
end
@time @safetestset "DSL Basic Model Construction" begin include("dsl/dsl_basic_model_construction.jl") end
@time @safetestset "DSL Advanced Model Construction" begin include("dsl/dsl_advanced_model_construction.jl") end
@time @safetestset "DSL Options" begin include("dsl/dsl_options.jl") end

# Tests compositional and hierarchical modelling.
@testset "CompositionalModelling" begin
@time @safetestset "ReactionSystem Components Based Creation" begin include("compositional_modelling/component_based_model_creation.jl") end
end
@time @safetestset "ReactionSystem Components Based Creation" begin include("compositional_modelling/component_based_model_creation.jl") end
end

if GROUP == "All" || GROUP == "Miscellaneous-NetworkAnalysis"
# Tests various miscellaneous features.
@testset "Miscellaneous" begin
@time @safetestset "API" begin include("miscellaneous_tests/api.jl") end
@time @safetestset "Compound Species" begin include("miscellaneous_tests/compound_macro.jl") end
@time @safetestset "Reaction Balancing" begin include("miscellaneous_tests/reaction_balancing.jl") end
@time @safetestset "Units" begin include("miscellaneous_tests/units.jl") end
end
@time @safetestset "API" begin include("miscellaneous_tests/api.jl") end
@time @safetestset "Compound Species" begin include("miscellaneous_tests/compound_macro.jl") end
@time @safetestset "Reaction Balancing" begin include("miscellaneous_tests/reaction_balancing.jl") end
@time @safetestset "Units" begin include("miscellaneous_tests/units.jl") end

# Tests reaction network analysis features.
@testset "NetworkAnalysis" begin
@time @safetestset "Conservation Laws" begin include("network_analysis/conservation_laws.jl") end
@time @safetestset "Network Properties" begin include("network_analysis/network_properties.jl") end
end
@time @safetestset "Conservation Laws" begin include("network_analysis/conservation_laws.jl") end
@time @safetestset "Network Properties" begin include("network_analysis/network_properties.jl") end
end

# Tests ODE, SDE, jump simulations, nonlinear solving, and steady state simulations.
if GROUP == "All" || GROUP == "Simulation"
@testset "Simulation" begin
@time @safetestset "ODE System Simulations" begin include("simulation_and_solving/simulate_ODEs.jl") end
@time @safetestset "Automatic Jacobian Construction" begin include("simulation_and_solving/jacobian_construction.jl") end
@time @safetestset "SDE System Simulations" begin include("simulation_and_solving/simulate_SDEs.jl") end
@time @safetestset "Jump System Simulations" begin include("simulation_and_solving/simulate_jumps.jl") end
@time @safetestset "Nonlinear and SteadyState System Solving" begin include("simulation_and_solving/solve_nonlinear.jl") end
end
# Tests ODE, SDE, jump simulations, nonlinear solving, and steady state simulations.
@time @safetestset "ODE System Simulations" begin include("simulation_and_solving/simulate_ODEs.jl") end
@time @safetestset "Automatic Jacobian Construction" begin include("simulation_and_solving/jacobian_construction.jl") end
@time @safetestset "SDE System Simulations" begin include("simulation_and_solving/simulate_SDEs.jl") end
@time @safetestset "Jump System Simulations" begin include("simulation_and_solving/simulate_jumps.jl") end
@time @safetestset "Nonlinear and SteadyState System Solving" begin include("simulation_and_solving/solve_nonlinear.jl") end

# Tests upstream SciML and DiffEq stuff.
@testset "Upstream" begin
@time @safetestset "MTK Structure Indexing" begin include("upstream/mtk_structure_indexing.jl") end
@time @safetestset "MTK Problem Inputs" begin include("upstream/mtk_problem_inputs.jl") end
end
@time @safetestset "MTK Structure Indexing" begin include("upstream/mtk_structure_indexing.jl") end
@time @safetestset "MTK Problem Inputs" begin include("upstream/mtk_problem_inputs.jl") end
end

# Tests spatial modelling and simulations.
if GROUP == "All" || GROUP == "Spatial"
@testset "Spatial" begin
@time @safetestset "PDE Systems Simulations" begin include("spatial_modelling/simulate_PDEs.jl") end
@time @safetestset "Lattice Reaction Systems" begin include("spatial_modelling/lattice_reaction_systems.jl") end
@time @safetestset "ODE Lattice Systems Simulations" begin include("spatial_modelling/lattice_reaction_systems_ODEs.jl") end
end
# Tests spatial modelling and simulations.
@time @safetestset "PDE Systems Simulations" begin include("spatial_modelling/simulate_PDEs.jl") end
@time @safetestset "Lattice Reaction Systems" begin include("spatial_modelling/lattice_reaction_systems.jl") end
@time @safetestset "ODE Lattice Systems Simulations" begin include("spatial_modelling/lattice_reaction_systems_ODEs.jl") end
end

if GROUP == "All" || GROUP == "Visualisation-Extensions"
# Tests network visualisation.
@testset "Visualisation" begin
@time @safetestset "Latexify" begin include("visualisation/latexify.jl") end
# Disable on Macs as can't install GraphViz via jll
if !Sys.isapple()
@time @safetestset "Graphs Visualisations" begin include("visualisation/graphs.jl") end
end
@time @safetestset "Latexify" begin include("visualisation/latexify.jl") end
# Disable on Macs as can't install GraphViz via jll
if !Sys.isapple()
@time @safetestset "Graphs Visualisations" begin include("visualisation/graphs.jl") end
end

# Tests extensions.
@testset "Extensions" begin
# @time @safetestset "BifurcationKit Extension" begin include("extensions/bifurcation_kit.jl") end
# @time @safetestset "HomotopyContinuation Extension" begin include("extensions/homotopy_continuation.jl") end
# @time @safetestset "Structural Identifiability Extension" begin include("extensions/structural_identifiability.jl") end
end
# @time @safetestset "BifurcationKit Extension" begin include("extensions/bifurcation_kit.jl") end
# @time @safetestset "HomotopyContinuation Extension" begin include("extensions/homotopy_continuation.jl") end
# @time @safetestset "Structural Identifiability Extension" begin include("extensions/structural_identifiability.jl") end
end

end # @time
Loading