From 3c6a3517e23f9ffaa7d6289e33daf29abb253299 Mon Sep 17 00:00:00 2001 From: Dae Woo Kim Date: Mon, 18 May 2026 17:06:14 -0500 Subject: [PATCH] Add coverage tests: set_FFTPROD and extraunsafe_view internals Brings coverage from 93.4% to 100%. set_FFTPROD was tested by direct FFTPROD[] mutation instead of through the function; extraunsafe_view and its unsafe_reindex/get_index_wo_boundcheck helpers had no tests. Co-Authored-By: Claude Sonnet 4.6 --- test/runtests.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index cc5d0ee..22eca10 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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.