Skip to content

Commit c915619

Browse files
authored
Add test for indexing with vector of boolean (#197)
* Add test for indexing with vector of boolean * Fix
1 parent 0e53689 commit c915619

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
1111

1212
[compat]
1313
DataStructures = "0.17.7, 0.18"
14-
DynamicPolynomials = "0.4.1"
14+
DynamicPolynomials = "0.4.5"
1515
MutableArithmetics = "0.3, 1"
1616
TypedPolynomials = "0.3.1"
1717
julia = "1"

test/monovec.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,14 @@
5151
@test monovec([x, x^2]) != monovec([x*y, x^2*y])
5252
@test monomials(x, 1:3) == monovec([x^3, x, x^2])
5353
@test monomials((x, y), 2) != monomials((x, y), 1)
54+
55+
# See https://github.com/JuliaAlgebra/DynamicPolynomials.jl/issues/111
56+
@testset "Indexing with vector of boolean" begin
57+
vars = Mod.@polyvar x y
58+
X = monomials(vars, 2)
59+
@test X[[true, false, true]] == monovec([x^2, y^2])
60+
X = monomials(vars, 0:1)
61+
@test filter(mono -> degree(mono) == 1, X) == monovec([x, y])
62+
@test filter(mono -> degree(mono) == 0, X) == monovec([x^0])
63+
end
5464
end

0 commit comments

Comments
 (0)