|
| 1 | +function run_core_functionality_tests() |
| 2 | + @testset "Core Functionality" begin |
| 3 | + |
| 4 | + @testset "Data Types Validation" begin |
| 5 | + # Test that all main data types are exported and defined |
| 6 | + @test :InfoType in names(Mera) |
| 7 | + @test :HydroDataType in names(Mera) |
| 8 | + @test :GravDataType in names(Mera) |
| 9 | + @test :PartDataType in names(Mera) |
| 10 | + @test :ClumpDataType in names(Mera) |
| 11 | + @test :PhysicalUnitsType001 in names(Mera) |
| 12 | + @test :ScalesType001 in names(Mera) |
| 13 | + |
| 14 | + # Test that data types are properly defined |
| 15 | + @test isa(Mera.PhysicalUnitsType001, DataType) |
| 16 | + @test isa(Mera.ScalesType001, DataType) |
| 17 | + @test isa(Mera.InfoType, DataType) |
| 18 | + @test isa(Mera.HydroDataType, DataType) |
| 19 | + @test isa(Mera.GravDataType, DataType) |
| 20 | + @test isa(Mera.PartDataType, DataType) |
| 21 | + end |
| 22 | + |
| 23 | + @testset "Core Functions Exported" begin |
| 24 | + # Test that key functions are exported |
| 25 | + @test :gethydro in names(Mera) |
| 26 | + @test :getgravity in names(Mera) |
| 27 | + @test :getparticles in names(Mera) |
| 28 | + @test :getclumps in names(Mera) |
| 29 | + @test :projection in names(Mera) |
| 30 | + @test :subregion in names(Mera) |
| 31 | + @test :shellregion in names(Mera) |
| 32 | + @test :getinfo in names(Mera) |
| 33 | + @test :getvar in names(Mera) |
| 34 | + end |
| 35 | + |
| 36 | + @testset "Utility Functions" begin |
| 37 | + # Test that core functions are defined and callable |
| 38 | + @test isdefined(Mera, :viewdata) |
| 39 | + @test isdefined(Mera, :viewfields) |
| 40 | + @test isdefined(Mera, :viewmodule) |
| 41 | + |
| 42 | + # Test that configuration functions work |
| 43 | + @test isdefined(Mera, :verbose) |
| 44 | + @test isdefined(Mera, :showprogress) |
| 45 | + @test verbose(true) isa Union{Nothing, Bool} |
| 46 | + @test verbose(false) isa Union{Nothing, Bool} |
| 47 | + @test showprogress(true) isa Union{Nothing, Bool} |
| 48 | + @test showprogress(false) isa Union{Nothing, Bool} |
| 49 | + end |
| 50 | + |
| 51 | + @testset "Error Handling" begin |
| 52 | + # Test that functions handle invalid inputs appropriately |
| 53 | + @test_throws Exception getinfo(path="/this/path/absolutely/does/not/exist") |
| 54 | + @test_throws Exception getinfo(output=-999) |
| 55 | + @test_throws Exception getinfo(output=0) |
| 56 | + end |
| 57 | + |
| 58 | + @testset "Module Structure" begin |
| 59 | + # Test that the module has expected exports |
| 60 | + exported_symbols = names(Mera) |
| 61 | + @test length(exported_symbols) > 100 |
| 62 | + |
| 63 | + # Test macros |
| 64 | + @test Symbol("@apply") in exported_symbols |
| 65 | + @test Symbol("@filter") in exported_symbols |
| 66 | + @test Symbol("@where") in exported_symbols |
| 67 | + @test Symbol("@mera_timer") in exported_symbols |
| 68 | + @test Symbol("@mera_benchmark") in exported_symbols |
| 69 | + |
| 70 | + # Test analysis functions |
| 71 | + @test :center_of_mass in exported_symbols |
| 72 | + @test :bulk_velocity in exported_symbols |
| 73 | + @test :average_mweighted in exported_symbols |
| 74 | + @test :average_velocity in exported_symbols |
| 75 | + end |
| 76 | + |
| 77 | + @testset "Performance Functions" begin |
| 78 | + # Test performance monitoring exists |
| 79 | + @test isdefined(Mera, :usedmemory) |
| 80 | + @test isdefined(Mera, :notifyme) |
| 81 | + @test isdefined(Mera, :bell) |
| 82 | + @test isdefined(Mera, :printtime) |
| 83 | + |
| 84 | + # Test that basic performance functions work |
| 85 | + @test_logs @test_nowarn notifyme() |
| 86 | + @test_logs @test_nowarn usedmemory(1000.0) |
| 87 | + end |
| 88 | + |
| 89 | + @testset "IO and Configuration" begin |
| 90 | + # Test IO functions exist |
| 91 | + @test isdefined(Mera, :configure_mera_io) |
| 92 | + @test isdefined(Mera, :optimize_mera_io) |
| 93 | + @test isdefined(Mera, :reset_mera_io) |
| 94 | + @test isdefined(Mera, :show_mera_config) |
| 95 | + @test isdefined(Mera, :mera_io_status) |
| 96 | + @test isdefined(Mera, :convertdata) |
| 97 | + @test isdefined(Mera, :savedata) |
| 98 | + @test isdefined(Mera, :loaddata) |
| 99 | + end |
| 100 | + |
| 101 | + @testset "Advanced Features" begin |
| 102 | + # Test projection and analysis functions |
| 103 | + @test isdefined(Mera, :projection_deprecated) |
| 104 | + @test isdefined(Mera, :project_amr_parallel) |
| 105 | + @test isdefined(Mera, :getextent) |
| 106 | + @test isdefined(Mera, :getmass) |
| 107 | + @test isdefined(Mera, :getpositions) |
| 108 | + @test isdefined(Mera, :getvelocities) |
| 109 | + @test isdefined(Mera, :gettime) |
| 110 | + |
| 111 | + # Test benchmarking |
| 112 | + @test isdefined(Mera, :run_benchmark) |
| 113 | + @test isdefined(Mera, :benchmark_projection_hydro) |
| 114 | + @test isdefined(Mera, :suggest_optimizations) |
| 115 | + @test isdefined(Mera, :show_auto_optimization_status) |
| 116 | + |
| 117 | + # Test cache management |
| 118 | + @test isdefined(Mera, :clear_mera_cache!) |
| 119 | + @test isdefined(Mera, :show_mera_cache_stats) |
| 120 | + @test isdefined(Mera, :clear_projection_buffers!) |
| 121 | + end |
| 122 | + |
| 123 | + @testset "File Operations" begin |
| 124 | + # Test file operation functions |
| 125 | + @test isdefined(Mera, :makefile) |
| 126 | + @test isdefined(Mera, :patchfile) |
| 127 | + @test isdefined(Mera, :timerfile) |
| 128 | + @test isdefined(Mera, :checksimulations) |
| 129 | + @test isdefined(Mera, :checkoutputs) |
| 130 | + @test isdefined(Mera, :amroverview) |
| 131 | + @test isdefined(Mera, :dataoverview) |
| 132 | + @test isdefined(Mera, :storageoverview) |
| 133 | + @test isdefined(Mera, :infodata) |
| 134 | + end |
| 135 | + |
| 136 | + @testset "Unit and Scale System" begin |
| 137 | + # Test unit and scale functions exist |
| 138 | + @test isdefined(Mera, :getunit) |
| 139 | + @test isdefined(Mera, :humanize) |
| 140 | + @test isdefined(Mera, :createscales) |
| 141 | + |
| 142 | + # Test basic unit conversion |
| 143 | + @test_logs @test_nowarn humanize(1000.0, 2, "") |
| 144 | + end |
| 145 | + |
| 146 | + @testset "Cache and Buffer Management" begin |
| 147 | + # Test cache and buffer functions |
| 148 | + @test isdefined(Mera, :clear_mera_cache!) |
| 149 | + @test isdefined(Mera, :clear_projection_buffers!) |
| 150 | + @test isdefined(Mera, :show_mera_cache_stats) |
| 151 | + @test isdefined(Mera, :show_projection_memory_stats) |
| 152 | + @test isdefined(Mera, :get_projection_buffer) |
| 153 | + @test isdefined(Mera, :recommend_buffer_size) |
| 154 | + end |
| 155 | + |
| 156 | + @testset "Threading and Parallel" begin |
| 157 | + # Test threading support |
| 158 | + @test isdefined(Mera, :show_threading_info) |
| 159 | + @test isdefined(Mera, :project_amr_parallel) |
| 160 | + @test isdefined(Mera, :balance_workload) |
| 161 | + end |
| 162 | + end |
| 163 | +end |
0 commit comments