Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "crate-ci/typos"
update-types: ["version-update:semver-patch", "version-update:semver-minor"]
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
InvertedIndices = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
62 changes: 62 additions & 0 deletions test/jet_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using ComponentArrays
using JET
using Test

@testset "JET Static Analysis" begin
# Create test ComponentArrays for analysis
ca = ComponentArray(a = 1.0, b = [2.0, 3.0], c = (x = 4.0, y = 5.0))
ca_simple = ComponentArray(a = 1.0, b = 2.0)
cmat = ca .* ca'

@testset "Core operations type stability" begin
# Test getindex with integer - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) ca[1]
@test length(JET.get_reports(rep)) == 0

# Test similar - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) similar(ca)
@test length(JET.get_reports(rep)) == 0

# Test copy - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) copy(ca)
@test length(JET.get_reports(rep)) == 0

# Test getdata - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) getdata(ca)
@test length(JET.get_reports(rep)) == 0

# Test getaxes - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) getaxes(ca)
@test length(JET.get_reports(rep)) == 0

# Test broadcast - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) broadcast(+, ca, ca)
@test length(JET.get_reports(rep)) == 0

# Test vcat - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) vcat(ca_simple, ca_simple)
@test length(JET.get_reports(rep)) == 0

# Test hcat - should be type stable
rep = @report_opt target_modules = (ComponentArrays,) hcat(ca_simple, ca_simple)
@test length(JET.get_reports(rep)) == 0
end

@testset "No runtime errors in basic usage" begin
# Check that basic operations don't have potential runtime errors
rep = @report_call ca[1]
@test length(JET.get_reports(rep)) == 0

rep = @report_call similar(ca)
@test length(JET.get_reports(rep)) == 0

rep = @report_call copy(ca)
@test length(JET.get_reports(rep)) == 0

rep = @report_call getdata(ca)
@test length(JET.get_reports(rep)) == 0

rep = @report_call getaxes(ca)
@test length(JET.get_reports(rep)) == 0
end
end
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -982,3 +982,7 @@ end
@testset "Reactant" begin
include("reactant_tests.jl")
end

@testset "JET" begin
include("jet_tests.jl")
end
Loading