diff --git a/src/crop/aquacrop.jl b/src/crop/aquacrop.jl index 9452ce1ef88151534dc0d455d799c092c7b987ec..cea2b2f112eefbc22104692fc3eaef6532116cd0 100644 --- a/src/crop/aquacrop.jl +++ b/src/crop/aquacrop.jl @@ -17,7 +17,7 @@ mutable struct AquaCropState function AquaCropState(croptype::AquaCropType, height::Length{Float64}=0.0cm) ac_parentdir = AquaCrop.test_toml_dir # TODO: hardcoded croptype ac_runtype = :Julia - cropstate, allok = AquaCrop.initialize_cropfield(ac_parentdir, ac_runtype) + cropstate, allok = AquaCrop.initialize_cropfield(; parentdir=ac_parentdir, runtype=ac_runtype) if ! allok.logi error("AquaCrop.initialize_cropfield() failed, status = $allok") end diff --git a/test/crop_tests.jl b/test/crop_tests.jl index aaf8f71da951922b8dc4cd2cbe4703175899d524..dabcf849074c09c137a6e7aae3eeb19963c4ecc8 100644 --- a/test/crop_tests.jl +++ b/test/crop_tests.jl @@ -3,17 +3,20 @@ ### 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") -const TESTPARAM_AQUACROP = joinpath(pkgdir(Persefone), "test", "test_parameters_aquacrop.toml") +import Unitful -@testset for paramfile in (TESTPARAM_ALMASS, TESTPARAM_SIMPLECROP, TESTPARAM_AQUACROP) +@testset for paramfile in [ + "test_parameters_almass.toml", + "test_parameters_simplecrop.toml", + "test_parameters_aquacrop.toml", +] + parampath = joinpath(pkgdir(Persefone), "test", paramfile) @testset "Model initialisation" begin - model = initialise(paramfile) + model = initialise(parampath) @test model isa AgricultureModel end @testset "Time step" begin - model = initialise(paramfile) + model = initialise(parampath) stepsimulation!(model) @test model isa AgricultureModel end @@ -65,6 +68,6 @@ end @test cropname(fp) isa String @test cropheight(fp) isa Length{Float64} @test cropcover(fp) isa Float64 - @test cropyield(fp) isa type(1.0u"kg/ha") + @test Unitful.dimension(cropyield(fp)) == Unitful.𝐌 * Unitful.𝐋^-2 # TODO: test stepagent!(), sow!(), harvest!() end