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")