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
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ EnzymeCore = "0.8"
FunctionWrappers = "1"
Mooncake = "0.5"
PrecompileTools = "1"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
TruncatedStacktraces = "1"
julia = "1.10"

[extras]
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Pkg", "Test", "Enzyme", "EnzymeCore", "Mooncake"]
test = ["Test", "SafeTestsets", "SciMLTesting", "Enzyme", "EnzymeCore", "Mooncake"]
File renamed without changes.
File renamed without changes.
261 changes: 0 additions & 261 deletions test/nopre/Manifest.toml

This file was deleted.

10 changes: 10 additions & 0 deletions test/nopre/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[deps]
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FunctionWrappersWrappers = {path = "../.."}

[compat]
SafeTestsets = "0.0.1, 0.1"
SciMLTesting = "1"
Test = "1"
96 changes: 29 additions & 67 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,67 +1,29 @@
using Test, Pkg

const GROUP = get(ENV, "GROUP", "All")

if GROUP == "All" || GROUP == "Core"
@testset "FunctionWrappersWrappers.jl" begin
include("basictests.jl")
end
end

if GROUP == "nopre"
Pkg.activate("nopre")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Pkg.instantiate()
include("nopre/jet_tests.jl")
end

@testset "BigFloat support" begin
fwplus_big = FunctionWrappersWrapper(
+,
(Tuple{BigFloat, BigFloat}, Tuple{Float64, Float64}),
(BigFloat, Float64)
)
a = BigFloat("3.14159265358979323846264338327950288")
b = BigFloat("2.71828182845904523536028747135266250")
@test fwplus_big(a, b) isa BigFloat
@test fwplus_big(a, b) == a + b
@test fwplus_big(1.0, 2.0) === 3.0

fwsin_big = FunctionWrappersWrapper(
sin,
(Tuple{BigFloat}, Tuple{Float64}),
(BigFloat, Float64)
)
@test fwsin_big(BigFloat("1.0")) isa BigFloat
@test fwsin_big(1.0) === sin(1.0)
end

@testset "UnionAll return types" begin
# Test that UnionAll types (like AbstractArray{Float64}) work as return types
function double_array(x::AbstractArray{Float64})
return x .* 2
end

fwdouble = FunctionWrappersWrapper(
double_array,
(Tuple{AbstractArray{Float64}},),
(AbstractArray{Float64},)
)

v = [1.0, 2.0, 3.0]
result = fwdouble(v)
@test result isa Vector{Float64}
@test result == [2.0, 4.0, 6.0]
end

if GROUP == "All" || GROUP == "Enzyme"
@testset "Enzyme extension" begin
include("enzyme_tests.jl")
end
end

if GROUP == "All" || GROUP == "Mooncake"
@testset "Mooncake extension" begin
include("mooncake_tests.jl")
end
end
using SafeTestsets
using SciMLTesting

run_tests(;
core = function ()
@safetestset "FunctionWrappersWrappers.jl" begin
include(joinpath(@__DIR__, "basictests.jl"))
end
return @safetestset "BigFloat + UnionAll" begin
include(joinpath(@__DIR__, "shared", "bigfloat_unionall_tests.jl"))
end
end,
groups = Dict(
"nopre" => (;
env = joinpath(@__DIR__, "nopre"),
body = function ()
@safetestset "JET" begin
include(joinpath(@__DIR__, "nopre", "jet_tests.jl"))
end
return @safetestset "BigFloat + UnionAll" begin
include(joinpath(@__DIR__, "shared", "bigfloat_unionall_tests.jl"))
end
end,
),
"Enzyme" => joinpath(@__DIR__, "Enzyme", "enzyme_tests.jl"),
"Mooncake" => joinpath(@__DIR__, "Mooncake", "mooncake_tests.jl"),
),
all = ["Core", "Enzyme", "Mooncake"],
)
Loading
Loading