2026-05-09 18:40:23 +03:00
|
|
|
# SPDX-FileCopyrightText: 2015-2026 Jukka Aho
|
|
|
|
|
# SPDX-License-Identifier: MIT
|
2015-06-24 23:43:00 +03:00
|
|
|
|
2018-09-06 12:05:41 +03:00
|
|
|
using JuliaFEM, Test
|
2017-07-20 17:11:37 +03:00
|
|
|
|
2026-05-11 02:38:59 +03:00
|
|
|
# Shared zero-allocation / LLVM IR helpers for topic tests (loaded once).
|
|
|
|
|
include(joinpath(@__DIR__, "zero_alloc_helpers.jl"))
|
|
|
|
|
include(joinpath(@__DIR__, "test_api_contract.jl"))
|
|
|
|
|
include(joinpath(@__DIR__, "test_pkg_hygiene.jl"))
|
|
|
|
|
include(joinpath(@__DIR__, "test_inference_smoke.jl"))
|
|
|
|
|
|
2026-05-09 18:40:23 +03:00
|
|
|
# The active test tree mirrors `src/`. Every subdirectory below has its
|
|
|
|
|
# own `runtests.jl` that bundles the topic into a single `@testset`.
|
|
|
|
|
# Adding a new topic = adding the directory to `topics` below.
|
|
|
|
|
const TOPICS = [
|
|
|
|
|
"basis",
|
|
|
|
|
"fields",
|
|
|
|
|
"physics",
|
|
|
|
|
"elements",
|
|
|
|
|
"materials",
|
|
|
|
|
"topology",
|
|
|
|
|
"geometry",
|
|
|
|
|
"mesh",
|
2026-05-11 03:06:10 +03:00
|
|
|
"io",
|
2026-05-09 18:40:23 +03:00
|
|
|
"quadrature",
|
|
|
|
|
"domains/continuum",
|
|
|
|
|
"domains/heat",
|
|
|
|
|
"domains/darcy",
|
|
|
|
|
"domains/thermo_elastic",
|
2026-05-11 02:38:59 +03:00
|
|
|
"domains/poroelastic",
|
|
|
|
|
"domains/thermo_poroelastic",
|
2026-05-09 18:40:23 +03:00
|
|
|
"dofs",
|
|
|
|
|
"interface",
|
|
|
|
|
"assemblers",
|
|
|
|
|
"sparse",
|
|
|
|
|
"validation",
|
|
|
|
|
"reference",
|
|
|
|
|
"docs",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# If ARGS has no positional topic names, run every entry in `TOPICS`.
|
|
|
|
|
# Otherwise run only listed topics (in `TOPICS` order). Unknown names warn;
|
|
|
|
|
# if none match, run the full suite with a warning.
|
|
|
|
|
#
|
|
|
|
|
# `Pkg.test(; test_args=["assemblers", ...])` forwards those strings to ARGS.
|
2026-05-11 02:38:59 +03:00
|
|
|
# Only names from `TOPICS` below are accepted (e.g. `"assemblers"`), not file paths.
|
2026-05-09 18:40:23 +03:00
|
|
|
function _topics_from_args()
|
|
|
|
|
requested = String[s for s in ARGS if !startswith(s, '-')]
|
|
|
|
|
isempty(requested) && return TOPICS
|
|
|
|
|
known = Set(TOPICS)
|
|
|
|
|
unknown = filter(!in(known), requested)
|
|
|
|
|
if !isempty(unknown)
|
|
|
|
|
@warn "Unknown test topics (skipped): $(collect(unknown))"
|
|
|
|
|
end
|
|
|
|
|
want = Set(requested)
|
|
|
|
|
chosen = filter(in(want), TOPICS)
|
|
|
|
|
if isempty(chosen)
|
|
|
|
|
@warn "No valid topics in ARGS $(requested); running full suite"
|
|
|
|
|
return TOPICS
|
|
|
|
|
end
|
|
|
|
|
return chosen
|
|
|
|
|
end
|
|
|
|
|
|
2017-07-20 17:11:37 +03:00
|
|
|
@testset "JuliaFEM.jl" begin
|
2025-11-18 15:09:51 +02:00
|
|
|
@testset "Package loads" begin
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractBasis)
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractMesh)
|
2026-05-09 18:40:23 +03:00
|
|
|
@test isdefined(JuliaFEM, :AbstractInterfaceMesh)
|
|
|
|
|
@test isdefined(JuliaFEM, :InterfaceMesh)
|
2025-11-18 15:09:51 +02:00
|
|
|
@test isdefined(JuliaFEM, :AbstractTopology)
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractMaterial)
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractPhysics)
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractField)
|
|
|
|
|
@test isdefined(JuliaFEM, :AbstractFormulation)
|
2018-09-06 12:05:41 +03:00
|
|
|
end
|
2025-11-18 15:09:51 +02:00
|
|
|
|
|
|
|
|
@testset "Basic types instantiate" begin
|
|
|
|
|
@test AbstractBasis isa Type
|
|
|
|
|
@test AbstractMesh isa Type
|
2026-05-09 18:40:23 +03:00
|
|
|
@test AbstractInterfaceMesh isa Type
|
2025-11-18 15:09:51 +02:00
|
|
|
@test AbstractTopology isa Type
|
|
|
|
|
@test AbstractMaterial isa Type
|
|
|
|
|
@test AbstractPhysics isa Type
|
|
|
|
|
@test AbstractField isa Type
|
|
|
|
|
@test AbstractFormulation isa Type
|
2018-09-06 12:05:41 +03:00
|
|
|
end
|
2025-11-18 15:09:51 +02:00
|
|
|
|
|
|
|
|
@testset "Concrete types exist" begin
|
|
|
|
|
@test Mesh isa Type
|
|
|
|
|
@test LinearElastic isa Type
|
|
|
|
|
@test Hex8 isa Type
|
|
|
|
|
@test Tet4 isa Type
|
2025-12-12 23:49:41 +02:00
|
|
|
@test LocalField isa Type
|
|
|
|
|
end
|
|
|
|
|
|
2026-05-11 02:38:59 +03:00
|
|
|
run_api_contract_tests(TOPICS, @__DIR__)
|
|
|
|
|
|
|
|
|
|
run_pkg_hygiene_tests()
|
|
|
|
|
run_inference_smoke_tests()
|
|
|
|
|
|
2026-05-09 18:40:23 +03:00
|
|
|
for topic in _topics_from_args()
|
|
|
|
|
include(joinpath(topic, "runtests.jl"))
|
2025-11-19 10:03:46 +02:00
|
|
|
end
|
2015-06-20 19:57:50 +03:00
|
|
|
end
|
2025-11-18 15:09:51 +02:00
|
|
|
|
2026-05-09 18:40:23 +03:00
|
|
|
# Tests that target the older / Legacy API or experimental specs live under
|
|
|
|
|
# `llm/design/legacy-tests/` and are not picked up by this runner.
|