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 src/ssqueue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ end

Base.IteratorSize(::Type{<:NodeIterator}) = Base.SizeUnknown()

Base.eltype(::Type{NodeIterator{<:DualLinkedQueue{T}}}) where {T} = SSQNode{T}
Base.eltype(::Type{NodeIterator{DualLinkedQueue{T}}}) where {T} = SSQNode{T}

function Base.iterate(
iter::NodeIterator{DualLinkedQueue{T}},
Expand Down
14 changes: 13 additions & 1 deletion test/ConcurrentCollectionsTests/src/test_ssqueue.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module TestSSQueue

using ConcurrentCollections
using ConcurrentCollections.Implementations: NodeIterator, check_invariance
using ConcurrentCollections.Implementations: NodeIterator, SSQNode, check_invariance
using ProgressLogging: @logprogress, @withprogress
using Test
using ..TestDLCRQ: check_concurrent_push_pop!
Expand Down Expand Up @@ -45,4 +45,16 @@ function test_concurrent_push_pop(ntrials = 100)
end
end

function test_nodeiterator()
q = DualLinkedQueue{Int}()
push!(q, 111)
push!(q, 222)
itr = NodeIterator(q)
@test eltype(itr) === SSQNode{Int}
nodes = collect(itr)
@test nodes[1].value == 111
@test nodes[2].value == 222
@test check_invariance(q)
end

end # module