### Persefone.jl - a model of agricultural landscapes and ecosystems in Europe. ### ### These are the tests for the crop growth models. ### const TESTPARAM_ALMASS = joinpath(pkgdir(Persefone), "test", "test_parameters_almass.toml") const TESTPARAM_SIMPLECROP = joinpath(pkgdir(Persefone), "test", "test_parameters_simplecrop.toml") @testset for configfile in (TESTPARAM_ALMASS, TESTPARAM_SIMPLECROP) @testset "Model initialisation" begin model = initialise(; configfile) @test model isa AgricultureModel end @testset "Time step" begin model = initialise(; configfile) stepsimulation!(model) @test model isa AgricultureModel end end @testset "Submodule ALMaSS" begin ct = Ps.ALMaSS.CropType("olive tree", "no_crop_group", false, missing, missing, missing, missing, missing, missing, missing) id = 0 pixels = [(0, 0)] farmer = 0 mature = false events = Ps.Management[] force_growth = false fp = FarmPlot(id, pixels, farmer, Ps.ALMaSS.CropState(ct, Ps.ALMaSS.janfirst, 0.0, 0.0m, 0.0, 0.0, mature, events, force_growth)) @test fp isa FarmPlot @test fp isa FarmPlot{Ps.ALMaSS.CropState} @test croptype(fp) isa Ps.ALMaSS.CropType @test cropname(fp) isa String @test cropheight(fp) isa Length{Float64} @test cropcover(fp) isa Float64 @test cropyield(fp) isa Float64 end @testset "Submodule SimpleCrop" begin ct = Ps.SimpleCrop.CropType("olive tree", "no_crop_group", AnnualDate(4, 1), AnnualDate(5, 1)) id = 0 pixels = [(0, 0)] farmer = 0 fp = FarmPlot(id, pixels, farmer, Ps.SimpleCrop.CropState(ct, 0.0cm)) @test fp isa FarmPlot @test fp isa FarmPlot{Ps.SimpleCrop.CropState} @test croptype(fp) isa Ps.SimpleCrop.CropType @test cropname(fp) isa String @test cropheight(fp) isa Length{Float64} @test cropcover(fp) isa Float64 @test cropyield(fp) isa Float64 end