From b4cb4d8252ba2d4abe4fcb7368c022699c0038a7 Mon Sep 17 00:00:00 2001 From: Alinson S Xavier Date: Tue, 1 Jun 2021 09:03:35 -0500 Subject: [PATCH] Add basic formulation tests --- Makefile | 2 +- test/model/formulations_test.jl | 17 +++++++++++++++++ test/runtests.jl | 3 ++- test/{model/build_test.jl => usage.jl} | 0 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/model/formulations_test.jl rename test/{model/build_test.jl => usage.jl} (100%) diff --git a/Makefile b/Makefile index 9344809..78e597d 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ test: build/sysimage.so format: - julia -e 'using JuliaFormatter; format("src"); format("test"); format("benchmark")' + julia -e 'using JuliaFormatter; format(["src", "test", "benchmark"], verbose=true);' install-deps: julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.14.4"))' diff --git a/test/model/formulations_test.jl b/test/model/formulations_test.jl new file mode 100644 index 0000000..dc39b2b --- /dev/null +++ b/test/model/formulations_test.jl @@ -0,0 +1,17 @@ +# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment +# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved. +# Released under the modified BSD license. See COPYING.md for more details. + +using UnitCommitment + +function _test(formulation::UnitCommitment.Formulation)::Nothing + instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") + UnitCommitment._build_model(instance, formulation) # should not crash + return +end + +@testset "formulations" begin + _test(UnitCommitment.Formulation(ramping = UnitCommitment.ArrCon00())) + _test(UnitCommitment.Formulation(ramping = UnitCommitment.DamKucRajAta16())) + _test(UnitCommitment.Formulation(ramping = UnitCommitment.MorLatRam13())) +end diff --git a/test/runtests.jl b/test/runtests.jl index 5abbcb5..2d9b31c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,6 +8,7 @@ using UnitCommitment UnitCommitment._setup_logger() @testset "UnitCommitment" begin + include("usage.jl") @testset "import" begin include("import/egret_test.jl") end @@ -15,7 +16,7 @@ UnitCommitment._setup_logger() include("instance/read_test.jl") end @testset "model" begin - include("model/build_test.jl") + include("model/formulations_test.jl") end @testset "XavQiuWanThi19" begin include("solution/methods/XavQiuWanThi19/filter_test.jl") diff --git a/test/model/build_test.jl b/test/usage.jl similarity index 100% rename from test/model/build_test.jl rename to test/usage.jl