From b2b08e68c17a1444409286102e2ca3703ddbc3ac Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Tue, 8 Nov 2022 10:02:21 +0100 Subject: [PATCH] include tests for constraint Matrices --- test/constratint_matrices.jl | 21 +++++++++++++++++++++ test/runtests.jl | 1 + 2 files changed, 22 insertions(+) create mode 100644 test/constratint_matrices.jl diff --git a/test/constratint_matrices.jl b/test/constratint_matrices.jl new file mode 100644 index 0000000..afdee61 --- /dev/null +++ b/test/constratint_matrices.jl @@ -0,0 +1,21 @@ +@testset "ConstraintMatrix" begin + @test PropertyT.ConstraintMatrix{Float64}([-1, 2, -1, 1, 4, 2, 6], 3, 2, π) isa AbstractMatrix + + cm = PropertyT.ConstraintMatrix{Float64}([-1, 2, -1, 1, 4, 2, 6], 3, 2, π) + + @test cm == Float64[ + -π π + 2π 0.0 + 0.0 π + ] + + @test collect(PropertyT.nzpairs(cm)) == [ + 1 => 3.141592653589793 + 2 => 3.141592653589793 + 2 => 3.141592653589793 + 4 => 3.141592653589793 + 6 => 3.141592653589793 + 1 => -3.141592653589793 + 1 => -3.141592653589793 + ] +end diff --git a/test/runtests.jl b/test/runtests.jl index daf0aa3..cdeac69 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,6 +17,7 @@ include("optimizers.jl") @testset "PropertyT" begin + include("constratint_matrices.jl") include("actions.jl") include("1703.09680.jl")