Skip to content

Commit

Permalink
test supports_autoenzyme to combinations; test both backends for wron…
Browse files Browse the repository at this point in the history
…g dims
  • Loading branch information
kylebeggs committed Dec 13, 2024
1 parent 0d669a0 commit f74aa98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 2 additions & 12 deletions test/combinations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ This file includes tests for:
if supported
@test integral(
testable.integrand, testable.geometry; diff_method = diff_method)testable.solution rtol=rtol
@test MeshIntegrals.supports_autoenzyme(testable.geometry) == true
else
@test_throws "not supported" integral(
testable.integrand, testable.geometry; diff_method = diff_method)
@test MeshIntegrals.supports_autoenzyme(testable.geometry) == false
end
end # for
end # function
Expand Down Expand Up @@ -184,9 +186,6 @@ end
end
solution = 2π * u"Ω*m"

# Enzyme support
@test MeshIntegrals.supports_autoenzyme(curve) == false

# Package and run tests
testable = TestableGeometry(integrand, curve, solution)
runtests(testable; rtol = 0.5e-2)
Expand Down Expand Up @@ -328,9 +327,6 @@ end
integrand(p) = 1.0u"A"
solution = Meshes.measure(cyl) * u"A"

# Enzyme support
@test MeshIntegrals.supports_autoenzyme(cyl) == false

# Package and run tests
testable = TestableGeometry(integrand, cyl, solution)
runtests(testable)
Expand All @@ -346,9 +342,6 @@ end
integrand(p) = 1.0u"A"
solution = Meshes.measure(cyl) * u"A"

# Enzyme support
@test MeshIntegrals.supports_autoenzyme(cyl) == false

# Package and run tests
testable = TestableGeometry(integrand, cyl, solution)
runtests(testable)
Expand Down Expand Up @@ -486,9 +479,6 @@ end
end
solution = 2π * radius * exp(-radius^2) * u"A*m"

# Enzyme support
@test MeshIntegrals.supports_autoenzyme(curve_cart) == false

# Package and run tests
testable_cart = TestableGeometry(integrand, curve_cart, solution)
runtests(testable_cart)
Expand Down
4 changes: 3 additions & 1 deletion test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Meshes
using MeshIntegrals: _default_diff_method, _parametric, _units, _zeros, _ones
using Unitful
using Enzyme
end

@testitem "Utilities" setup=[Utils] begin
Expand Down Expand Up @@ -35,7 +36,8 @@ end

# Test jacobian with wrong number of parametric coordinates
box = Box(Point(0, 0), Point(1, 1))
@test_throws ArgumentError jacobian(box, zeros(3))
@test_throws ArgumentError MeshIntegrals.jacobian(box, zeros(3), FiniteDifference())
@test_throws ArgumentError MeshIntegrals.jacobian(box, zeros(3), AutoEnzyme())
end

@testitem "_ParametricGeometry" setup=[Utils] begin
Expand Down

0 comments on commit f74aa98

Please sign in to comment.