diff --git a/Project.toml b/Project.toml index 4990f11..198cd31 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GraphDynamicalSystems" uuid = "13529e2e-ed53-56b1-bd6f-420b01fca819" authors = ["Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com>"] -version = "0.0.4" +version = "0.0.5" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/src/qualitative_networks.jl b/src/qualitative_networks.jl index 49b21f0..7a0a398 100644 --- a/src/qualitative_networks.jl +++ b/src/qualitative_networks.jl @@ -16,10 +16,10 @@ const base_qn_grammar = @csgrammar begin Val = Val - Val Val = Val / Val Val = Val * Val - Val = Min(Val, Val) - Val = Max(Val, Val) - Val = Ceil(Val) - Val = Floor(Val) + Val = min(Val, Val) + Val = max(Val, Val) + Val = ceil(Val) + Val = floor(Val) end const default_qn_constants = [0, 1, 2] @@ -404,10 +404,10 @@ function interpret(e::Union{Expr,Symbol,Int}, qn::QN) :($v1 - $v2) => interpret(v1, qn) - interpret(v2, qn) :($v1 / $v2) => interpret(v1, qn) / interpret(v2, qn) :($v1 * $v2) => interpret(v1, qn) * interpret(v2, qn) - :(Min($v1, $v2)) => min(interpret(v1, qn), interpret(v2, qn)) - :(Max($v1, $v2)) => max(interpret(v1, qn), interpret(v2, qn)) - :(Ceil($v)) => ceil(interpret(v, qn)) - :(Floor($v)) => floor(interpret(v, qn)) + :(min($v1, $v2)) => min(interpret(v1, qn), interpret(v2, qn)) + :(max($v1, $v2)) => max(interpret(v1, qn), interpret(v2, qn)) + :(ceil($v)) => ceil(interpret(v, qn)) + :(floor($v)) => floor(interpret(v, qn)) _ => error("Unhandled Expr in `interpret`: $e") end end diff --git a/test/qn_test.jl b/test/qn_test.jl index 5a0f74b..6c35e17 100644 --- a/test/qn_test.jl +++ b/test/qn_test.jl @@ -66,10 +66,10 @@ end set_state!(qn, :B, 2) @test interpret(:(A / B), qn) == 0.5 @test interpret(:(A / 2), qn) == 0.5 - @test interpret(:(Min(A, B)), qn) == 1 - @test interpret(:(Max(A, B)), qn) == 2 - @test interpret(:(Ceil(A / B)), qn) == 1 - @test interpret(:(Floor(A / B)), qn) == 0 + @test interpret(:(min(A, B)), qn) == 1 + @test interpret(:(max(A, B)), qn) == 2 + @test interpret(:(ceil(A / B)), qn) == 1 + @test interpret(:(floor(A / B)), qn) == 0 @test_throws r"Unhandled" interpret(:(nonexistent_function(A)), qn) end @@ -142,14 +142,16 @@ end @test_throws r"no activators or inhibitors" default_target_function(0, 4) end -@testitem "Load from BMA" begin +@testitem "Load from BMA" setup = [RandomSetup] begin using JSON + using DynamicalSystemsBase: step! bma_models_path = joinpath(@__DIR__, "resources", "bma_models") good_models = joinpath(bma_models_path, "well_formed_examples") for model_path in readdir(good_models; join = true) qn = QN(model_path) @test qn isa GraphDynamicalSystem + step!(create_qn_system(qn), 100) end bad_models = joinpath(bma_models_path, "error_examples")