1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-28 11:05:28 +01:00
PropertyT.jl/test/constratint_matrices.jl

30 lines
701 B
Julia
Raw Normal View History

2022-11-08 10:02:21 +01:00
@testset "ConstraintMatrix" begin
@test PropertyT.ConstraintMatrix{Float64}(
[-1, 2, -1, 1, 4, 2, 6],
3,
2,
π,
) isa AbstractMatrix
2022-11-08 10:02:21 +01:00
cm = PropertyT.ConstraintMatrix{Float64}([-1, 2, -1, 1, 4, 2, 6], 3, 2, π)
@test cm == Float64[
-π π
2π 0
0 π
2022-11-08 10:02:21 +01:00
]
@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
]
@test PropertyT.ConstraintMatrix{Float64}([-9:-1; 1:9], 3, 3, 1.0) ==
zeros(3, 3)
2022-11-08 10:02:21 +01:00
end