From 339510208d4bc2f8f3356ad7e2ddd654440ab792 Mon Sep 17 00:00:00 2001 From: Mike Ingold Date: Wed, 4 Dec 2024 17:01:09 -0500 Subject: [PATCH] Generate alias tests in a loop --- test/combinations.jl | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/test/combinations.jl b/test/combinations.jl index 14b72c1f..f881472a 100644 --- a/test/combinations.jl +++ b/test/combinations.jl @@ -54,36 +54,14 @@ end function runtests(testable::TestableGeometry, supports::SupportStatus) - #= - for fname in ("lineintegral", "surfaceintegral", "volumeintegral") - if supports.$fname - @test $fname(testable.integrand, testable.geometry) ≈ testable.solution + for alias in (lineintegral, surfaceintegral, volumeintegral) + alias_symbol = first(methods(alias)).name + if getfield(supports, alias_symbol) + @test alias(testable.integrand, testable.geometry) ≈ testable.solution else - @test_throws "not supported" $fname(testable.integrand, testable.geometry) + @test_throws "not supported" alias(testable.integrand, testable.geometry) end end - =# - - # lineintegral - if supports.lineintegral - @test lineintegral(testable.integrand, testable.geometry) ≈ testable.solution - else - @test_throws "not supported" lineintegral(testable.integrand, testable.geometry) - end - - # surfaceintegral - if supports.surfaceintegral - @test surfaceintegral(testable.integrand, testable.geometry) ≈ testable.solution - else - @test_throws "not supported" surfaceintegral(testable.integrand, testable.geometry) - end - - # volumeintegral - if supports.volumeintegral - @test volumeintegral(testable.integrand, testable.geometry) ≈ testable.solution - else - @test_throws "not supported" volumeintegral(testable.integrand, testable.geometry) - end if supports.gausskronrod # Scalar integrand