From 27b5f6397eb09cf267d349c2637a279b51d00821 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Tue, 30 Dec 2025 05:44:37 -0500 Subject: [PATCH] Add JET.jl static analysis tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add JET.jl testing for type stability and error-free static analysis: - Add JET as a test dependency - Add test/jet.jl with static analysis tests for core functions - Test getindex, setindex!, size, and setdiagonal! for errors - Test type stability of getindex and size This ensures the package maintains type stability and catches potential type inference issues during CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- test/Project.toml | 1 + test/jet.jl | 28 ++++++++++++++++++++++++++++ test/runtests.jl | 1 + 3 files changed, 30 insertions(+) create mode 100644 test/jet.jl diff --git a/test/Project.toml b/test/Project.toml index 351c06d..6b01067 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" diff --git a/test/jet.jl b/test/jet.jl new file mode 100644 index 0000000..7ef397d --- /dev/null +++ b/test/jet.jl @@ -0,0 +1,28 @@ +using SparseBandedMatrices, JET, LinearAlgebra + +@testset "JET static analysis" begin + # Test that there are no unresolved dispatch errors in key functions + @testset "Error-free analysis" begin + rep = JET.report_call(getindex, (SparseBandedMatrix{Float64}, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(setindex!, (SparseBandedMatrix{Float64}, Float64, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(size, (SparseBandedMatrix{Float64},)) + @test length(JET.get_reports(rep)) == 0 + + rep = JET.report_call(setdiagonal!, (SparseBandedMatrix{Float64}, Vector{Float64}, Bool)) + @test length(JET.get_reports(rep)) == 0 + end + + @testset "Type stability for core operations" begin + # Test getindex type stability + rep = JET.report_opt(getindex, (SparseBandedMatrix{Float64}, Int, Int)) + @test length(JET.get_reports(rep)) == 0 + + # Test size type stability + rep = JET.report_opt(size, (SparseBandedMatrix{Float64},)) + @test length(JET.get_reports(rep)) == 0 + end +end diff --git a/test/runtests.jl b/test/runtests.jl index af3a211..1adeb88 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,6 +2,7 @@ using SafeTestsets, Test @testset "SparseBandedMatrices" begin @safetestset "Quality Assurance" include("qa.jl") + @safetestset "JET Static Analysis" include("jet.jl") @safetestset "Constructors" begin using SparseBandedMatrices