Skip to content

Commit

Permalink
remove setindex tests (#365)
Browse files Browse the repository at this point in the history
Fix #363 which was caused by removal of  `setindex` in #305
  • Loading branch information
Tokazama authored Nov 7, 2022
1 parent 87e65bc commit 9e58cb2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
52 changes: 0 additions & 52 deletions lib/ArrayInterfaceCore/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ using ArrayInterfaceCore
using ArrayInterfaceCore: zeromatrix, undefmatrix
import ArrayInterfaceCore: has_sparsestruct, findstructralnz, fast_scalar_indexing, lu_instance,
parent_type, zeromatrix, IndicesInfo
using Base: setindex
using LinearAlgebra
using Random
using SparseArrays
Expand Down Expand Up @@ -190,57 +189,6 @@ end
@test !@inferred(ArrayInterfaceCore.issingular(Tridiagonal([1,2,3],[1,2,3,4],[4,5,6])))
end

@testset "setindex" begin
@testset "$(typeof(x))" for x in [
zeros(3),
falses(3),
spzeros(3),
]
y = setindex(x, true, 1)
@test iszero(x) # x is not mutated
@test y[1] == true
@test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1)]])

y2 = setindex(x, one.(x), :)
@test iszero(x)
@test all(isone, y2)
end

@testset "$(typeof(x))" for x in [
zeros(3, 3),
falses(3, 3),
spzeros(3, 3),
]
y = setindex(x, true, 1, 1)
@test iszero(x) # x is not mutated
@test y[1, 1] == true
@test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1, 1)]])

y2 = setindex(x, one.(x), :, :)
@test iszero(x)
@test all(isone, y2)
end

@testset "$(typeof(x))" for x in [
zeros(3, 3, 3),
falses(3, 3, 3),
]
y = setindex(x, true, 1, 1, 1)
@test iszero(x) # x is not mutated
@test y[1, 1, 1] == true
@test iszero(x[CartesianIndices(size(x)) .== [CartesianIndex(1, 1, 1)]])

y2 = setindex(x, one.(x), :, :, :)
@test iszero(x)
@test all(isone, y2)
end

@testset "string" begin
x = fill("a", 2, 3)
@test setindex(x, "b", 2, 1) == setindex(x, "b", CartesianIndex(2, 1)) == ["a" "a" "a";"b" "a" "a"]
end
end

@testset "Sparsity Structure" begin
D=Diagonal([1,2,3,4])
@test has_sparsestruct(D)
Expand Down
2 changes: 0 additions & 2 deletions test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ end
@test ArrayInterface.static_first(Base.OneTo(one(UInt))) === static(1)
@test ArrayInterface.static_step(Base.OneTo(one(UInt))) === static(1)

@test Base.setindex(1:5, [6,2], 1:2) == [6,2,3,4,5]

@test @inferred(eachindex(static(-7):static(7))) === static(1):static(15)
@test @inferred((static(-7):static(7))[first(eachindex(static(-7):static(7)))]) == -7

Expand Down

0 comments on commit 9e58cb2

Please sign in to comment.