From ae144f93fb246c29323dc9a1b3eb546fdf1a867b Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Thu, 20 Nov 2025 16:56:38 +0200 Subject: [PATCH] test(continuum): Update test suite includes for new architecture Removed old test files: - test_kernel_allocations.jl (deleted) Added new test files: - test_dofs_per_node.jl - DOF mapping tests - test_dof_mapping.jl - Field to DOF mapping - test_helpers.jl - Utility function tests - test_kernel_functions.jl - Kernel computation tests - test_reset_functions.jl - Cache reset tests - test_cache_updates.jl - Three-phase cache update tests - test_compute_block.jl - Block computation tests - test_full_assembly.jl - End-to-end assembly tests - test_validation_hex8.jl - Hex8 element validation Test suite restructured to match new cache architecture. --- test/domains/continuum/runtests.jl | 84 ++++++++++++++---------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/test/domains/continuum/runtests.jl b/test/domains/continuum/runtests.jl index e0389f3..5de40dc 100644 --- a/test/domains/continuum/runtests.jl +++ b/test/domains/continuum/runtests.jl @@ -1,80 +1,76 @@ -# This file is a part of JuliaFEM. -# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md - """ Test suite for continuum mechanics domain. -This test suite ensures: -1. Zero-allocation property is maintained for performance-critical paths -2. Type stability for all integration and assembly functions -3. Material trait system works correctly with generic integration -4. Backward compatibility with existing code +Organized by priority: +1. Fix errors first +2. Then correctness +3. Finally zero allocations -Run with: include("test/domains/continuum/runtests.jl") +Run with: julia --project=. test/domains/continuum/runtests.jl """ using Test using JuliaFEM +using Tensors +using LinearAlgebra + +# Load shared helper functions +include("test_helpers.jl") @testset "Continuum Domain Tests" begin @testset "Material Trait System" begin @testset "LinearElastic traits" begin mat = LinearElastic(E=210e9, ν=0.3) - @test material_behavior(mat) isa StatelessConstantTangent @test needs_deformation(mat) == false @test needs_state(mat) == false - - println(" ✓ LinearElastic: StatelessConstantTangent") end @testset "NeoHookean traits" begin mat = NeoHookean(μ=1e6, λ=1e9) - @test material_behavior(mat) isa StatelessStrainDependent @test needs_deformation(mat) == true @test needs_state(mat) == false - - println(" ✓ NeoHookean: StatelessStrainDependent") end - - # PerfectPlasticity will be tested once it's exported - # @testset "PerfectPlasticity traits" begin - # mat = PerfectPlasticity(E=210e9, ν=0.3, σ_y=250e6, H=1e9) - # - # @test material_behavior(mat) isa StatefulStrainDependent - # @test needs_deformation(mat) == true - # @test needs_state(mat) == true - # - # println(" ✓ PerfectPlasticity: StatefulStrainDependent") - # end end - @testset "Zero-Allocation Tests" begin - println("\n Running allocation tests...") - include("test_kernel_allocations.jl") + @testset "Hex8 Element Validation (Correctness)" begin + include("test_validation_hex8.jl") end - # Type stability tests work when run directly but cause issues in test suite - # Run manually with: julia --project=. test/domains/continuum/test_type_stability.jl - # @testset "Type Stability Tests" begin - # println("\n Running type stability tests...") - # include("test_type_stability.jl") - # end + @testset "DOF Mapping (Correctness)" begin + include("test_dofs_per_node.jl") + include("test_dof_mapping.jl") + end - # Stiffness block allocation tests are more detailed/diagnostic - # Uncomment to run detailed allocation profiling: - # @testset "Stiffness Block Allocation Tests" begin - # println("\n Running detailed stiffness block allocation tests...") - # include("test_stiffness_block_allocations.jl") - # end + @testset "Cache Reset Functions" begin + include("test_reset_functions.jl") + end + + @testset "Cache Update Functions (Three-Phase API)" begin + include("test_cache_updates.jl") + end + + @testset "Kernel Functions" begin + include("test_kernel_functions.jl") + include("test_compute_block.jl") + end + + @testset "Full Assembly Workflow" begin + include("test_full_assembly.jl") + end end println("\n" * "="^70) println("CONTINUUM DOMAIN TEST SUMMARY") println("="^70) -println("✓ Material trait system verified") -println("✓ Zero-allocation property maintained") -println("✓ Type stability confirmed") +println("Test organization:") +println(" 1. Material traits - Type system verification") +println(" 2. Hex8 validation - Correctness against analytical solution") +println(" 3. DOF mapping - Index computation correctness") +println(" 4. Cache resets - Zero-allocation reset functions") +println(" 5. Cache updates - Three-phase update workflow") +println(" 6. Kernel functions - Weak form and integration") +println(" 7. Full assembly - Complete workflow validation") println("="^70)