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
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
[compat]
Aqua = "0.8"
ArrayInterface = "7.11"
JET = "0.9, 0.10, 0.11"
Pkg = "1.10"
PrecompileTools = "1"
SafeTestsets = "0.1"
Expand All @@ -18,9 +19,10 @@ julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Pkg", "Test", "SafeTestsets"]
test = ["Aqua", "JET", "Pkg", "Test", "SafeTestsets"]
37 changes: 36 additions & 1 deletion test/qa.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SciMLStructures, Aqua
using SciMLStructures, Aqua, JET
using SciMLStructures: Tunable, Constants, Caches, Discrete, Initials,
canonicalize, hasportion, isscimlstructure, replace

@testset "Aqua" begin
Aqua.find_persistent_tasks_deps(SciMLStructures)
Aqua.test_ambiguities(SciMLStructures, recursive = false)
Expand All @@ -9,3 +12,35 @@ using SciMLStructures, Aqua
Aqua.test_unbound_args(SciMLStructures)
Aqua.test_undefined_exports(SciMLStructures)
end

@testset "JET static analysis" begin
x = [1.0, 2.0, 3.0]
mat = [1.0 2.0; 3.0 4.0]

@testset "hasportion type stability" begin
@test_opt target_modules = (SciMLStructures,) hasportion(Tunable(), x)
@test_opt target_modules = (SciMLStructures,) hasportion(Constants(), x)
@test_opt target_modules = (SciMLStructures,) hasportion(Caches(), x)
@test_opt target_modules = (SciMLStructures,) hasportion(Discrete(), x)
@test_opt target_modules = (SciMLStructures,) hasportion(Initials(), x)
end

@testset "isscimlstructure type stability" begin
@test_opt target_modules = (SciMLStructures,) isscimlstructure(x)
@test_opt target_modules = (SciMLStructures,) isscimlstructure(mat)
end

@testset "canonicalize type stability" begin
@test_opt target_modules = (SciMLStructures,) canonicalize(Tunable(), x)
@test_opt target_modules = (SciMLStructures,) canonicalize(Constants(), x)
@test_opt target_modules = (SciMLStructures,) canonicalize(Caches(), x)
@test_opt target_modules = (SciMLStructures,) canonicalize(Discrete(), x)
@test_opt target_modules = (SciMLStructures,) canonicalize(Tunable(), mat)
end

@testset "replace type stability" begin
@test_opt target_modules = (SciMLStructures,) replace(Tunable(), x, [4.0, 5.0, 6.0])
@test_opt target_modules = (SciMLStructures,) replace(
Tunable(), mat, [5.0, 6.0, 7.0, 8.0])
end
end
Loading