Skip to content
Merged
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
27 changes: 27 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ DocMeta.setdocmeta!(RegisterMismatchCommon, :DocTestSetup, :(using RegisterMisma
@test RegisterMismatchCommon.FFTPROD[] == old
end

@testset "set_FFTPROD" begin
old = copy(RegisterMismatchCommon.FFTPROD[])
set_FFTPROD([2, 3, 5])
@test RegisterMismatchCommon.FFTPROD[] == [2, 3, 5]
set_FFTPROD(old)
@test RegisterMismatchCommon.FFTPROD[] == old
end

@testset "tovec" begin
v = [1, 2, 3]
@test tovec(v) === v
Expand Down Expand Up @@ -418,6 +426,25 @@ DocMeta.setdocmeta!(RegisterMismatchCommon, :DocTestSetup, :(using RegisterMisma
@test eltype(first(mms_gs)) === NumDenom{Float32}
end

@testset "extraunsafe_view" begin
A = reshape(collect(1:16), 4, 4)

# UnitRange path: exercises unsafe_reindex(UnitRange) and get_index_wo_boundcheck
V = view(A, 1:4, 1:4)
W = RegisterMismatchCommon.extraunsafe_view(V, 1:3, 1:3)
@test collect(W) == A[1:3, 1:3]

# Scalar (dropped-dimension) path: V.indices contains a scalar, exercises unsafe_reindex(Real)
V2 = view(A, 2, 1:4)
W2 = RegisterMismatchCommon.extraunsafe_view(V2, 1:3)
@test collect(W2) == A[2, 1:3]

# AbstractArray index path: exercises unsafe_reindex(AbstractArray)
V3 = view(A, [1, 3], 1:4)
W3 = RegisterMismatchCommon.extraunsafe_view(V3, 1:2, 1:3)
@test collect(W3) == A[[1, 3], 1:3]
end

@testset "register_translate (thresh shim)" begin
# Stub out the protocol mismatch method so register_translate can be exercised
# without a concrete RegisterMismatch package.
Expand Down
Loading