Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ProblemReductions"
uuid = "899c297d-f7d2-4ebf-8815-a35996def416"
authors = ["GiggleLiu <[email protected]> and contributors"]
version = "0.3.3"
version = "0.3.4"

[deps]
BitBasis = "50ba71b6-fa0f-514d-ae9a-0916efc90dcf"
Expand Down
3 changes: 2 additions & 1 deletion src/models/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@
struct UnitWeight <: AbstractVector{Int}
n::Int
end
Base.getindex(::UnitWeight, i) = 1
Base.getindex(::UnitWeight, i::Integer) = 1

Check warning on line 314 in src/models/models.jl

View check run for this annotation

Codecov / codecov/patch

src/models/models.jl#L314

Added line #L314 was not covered by tests
Base.getindex(::UnitWeight, inds::AbstractVector) = UnitWeight(length(inds))
Base.size(w::UnitWeight) = (w.n,)

"""
Expand Down
8 changes: 8 additions & 0 deletions test/models/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ using Test, ProblemReductions
@test ProblemReductions.combinations(3, 2) == [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]
end

@testset "UnitWeight" begin
w = UnitWeight(3)
@test w[1] == 1
@test w[2] == 1
@test w[3] == 1
@test w[1:2] === UnitWeight(2)
end

@testset "Circuit" begin
include("Circuit.jl")
end
Expand Down
Loading