Skip to content

Commit 2de6f8d

Browse files
committed
Add tests for CartesianGrid, add missing ustrip import
1 parent c9a71b1 commit 2de6f8d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/combinations.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This file includes tests for:
1818
import LinearAlgebra: norm
1919
using Meshes
2020
using MeshIntegrals
21-
import Unitful: @u_str, Quantity
21+
import Unitful: @u_str, Quantity, ustrip
2222
import Enzyme
2323

2424
# Used for testing callable objects as integrand functions
@@ -272,6 +272,26 @@ end
272272
runtests(testable; rtol = 1e-6)
273273
end
274274

275+
@testitem "Meshes.CartesianGrid" setup=[Combinations] begin
276+
# Geometry
277+
a = π
278+
start = Point(0, 0)
279+
finish = Point(a, a)
280+
dims = (4, 4)
281+
grid = CartesianGrid(start, finish, dims=dims)
282+
283+
# Integrand & Solution
284+
function integrand(p::Meshes.Point)
285+
x₁, x₂ = ustrip.(to(p))
286+
((a^2 - x₁^2) + (a^2 - x₂^2)) * u"A"
287+
end
288+
solution = 2a ** a^2 / 4) * u"A*m^2"
289+
290+
# Package and run tests
291+
testable = TestableGeometry(integrand, grid, solution)
292+
runtests(testable)
293+
end
294+
275295
@testitem "Meshes.Circle" setup=[Combinations] begin
276296
# Geometry
277297
center = Point(1, 2, 3)

0 commit comments

Comments
 (0)