Skip to content
Snippets Groups Projects
Unverified Commit c18a994e authored by St. Elmo's avatar St. Elmo
Browse files

added more tests

parent 6c2b6204
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,14 @@ using Base: lowerbound, upperbound
change_bound!(cp, "r1", lower_bound=-101, upper_bound=101)
@test cp.xl[1] == -101
@test cp.xu[1] == 101
change_bounds!(cp, ["r1","r2"]; lower_bounds=[-113, -12.23], upper_bounds=[113, 233.0])
change_bounds!(cp, ["r1","r2"]; lower_bounds=[-113, -12.23], upper_bounds=[114, 233.0])
@test cp.xl[2] == -12.23
@test cp.xu[1] == 113
@test cp.xu[1] == 114
change_bounds!(cp, ["r1","r2"]; lower_bounds=[-114, nothing], upper_bounds=[nothing, 2333.0])
@test cp.xl[1] == -114
@test cp.xl[2] == -12.23
@test cp.xu[1] == 114
@test cp.xu[2] == 2333
new_model = change_bound(cp, 1, lower_bound=-10, upper_bound=10)
@test new_model.xl[1] == -10
......@@ -26,9 +31,14 @@ using Base: lowerbound, upperbound
new_model = change_bound(cp, "r1", lower_bound=-101, upper_bound=101)
@test new_model.xl[1] == -101
@test new_model.xu[1] == 101
new_model = change_bounds(cp, ["r1","r2"]; lower_bounds=[-113, -12.23], upper_bounds=[113, 233.0])
new_model = change_bounds(cp, ["r1","r2"]; lower_bounds=[-113, -12.23], upper_bounds=[113, 1000])
@test new_model.xl[2] == -12.23
@test new_model.xu[1] == 113
new_model = change_bounds(cp, ["r1", "r2"]; lower_bounds=[nothing, -10], upper_bounds=[110, nothing])
@test new_model.xl[1] == -114
@test new_model.xl[2] == -10
@test new_model.xu[1] == 110
@test new_model.xu[2] == 2333
end
@testset "Verify consistency" begin
......
......@@ -36,24 +36,40 @@
change_bound!(model, "r2"; lower_bound=-10, upper_bound=10)
@test model.reactions["r2"].lb == -10
@test model.reactions["r2"].ub == 10
change_bounds!(model, ["r1", "r2"]; lower_bounds=[-10, -20], upper_bounds=[10.0, 20.0])
@test model.reactions["r1"].lb == -10
@test model.reactions["r1"].ub == 10
@test model.reactions["r2"].lb == -20
@test model.reactions["r2"].ub == 20
change_bound!(model, "r2"; lower_bound=-100)
@test model.reactions["r2"].lb == -100
@test model.reactions["r2"].ub == 10
change_bound!(model, "r2"; upper_bound=111)
@test model.reactions["r2"].lb == -100
@test model.reactions["r2"].ub == 111
change_bounds!(model, ["r1", "r2"]; lower_bounds=[-110, -220], upper_bounds=[110.0, 220.0])
@test model.reactions["r1"].lb == -110
@test model.reactions["r1"].ub == 110
@test model.reactions["r2"].lb == -220
@test model.reactions["r2"].ub == 220
# change bound - new model
new_model = change_bound(model, "r2"; lower_bound=-10, upper_bound=10)
@test new_model.reactions["r2"].lb == -10
@test new_model.reactions["r2"].ub == 10
new_model = change_bound(model, "r2"; lower_bound=-10)
@test new_model.reactions["r2"].lb == -10
@test new_model.reactions["r2"].ub == 220
new_model = change_bounds(model, ["r1", "r2"]; lower_bounds=[-10, -20], upper_bounds=[10.0, 20.0])
@test new_model.reactions["r1"].lb == -10
@test new_model.reactions["r1"].ub == 10
@test new_model.reactions["r2"].lb == -20
@test new_model.reactions["r2"].ub == 20
new_model = change_bounds(model, ["r1", "r2"]; lower_bounds=[-10, nothing], upper_bounds=[nothing, 20.0])
@test new_model.reactions["r1"].lb == -10
@test new_model.reactions["r1"].ub == 110
@test new_model.reactions["r2"].lb == -220
@test new_model.reactions["r2"].ub == 20
### reactions
add_reactions!(model, [r3, r4])
@test length(model.reactions) == 4
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment