Skip to content

Commit 050c796

Browse files
authored
Fix 113 and add regression (#114)
Signed-off-by: Don MacMillen <[email protected]>
1 parent abdeadc commit 050c796

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/operations/extract.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function extract!(
134134
w::AbstractGBVector, u::AbstractGBVector, I;
135135
mask = nothing, accum = nothing, desc = nothing
136136
)
137-
_canbeoutput(C) || throw(ShallowException())
137+
_canbeoutput(w) || throw(ShallowException())
138138
I, ni = idx(I)
139139
I = decrement!(I)
140140
desc = _handledescriptor(desc; out=w)
@@ -151,4 +151,4 @@ function extract(
151151
wlen = _outlength(u, I)
152152
w = similar(u, wlen)
153153
return extract!(w, u, I; mask, accum, desc)
154-
end
154+
end

test/operations/extract.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@testset "extract" begin
2+
m = GBVector([1,2,3,4,5,6])
3+
#extract correctness
4+
@test all(m[1:3] .== [1,2,3])
5+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ println("$(SuiteSparseGraphBLAS.get_lib())")
7878
include_test("types.jl")
7979
include_test("issues.jl")
8080
include_test("operations/ewise.jl")
81+
include_test("operations/extract.jl")
8182
include_test("operations/kron.jl")
8283
include_test("operations/map.jl")
8384
include_test("operations/mul.jl")

0 commit comments

Comments
 (0)