Skip to content
Snippets Groups Projects
Commit 03e65514 authored by xo30xoqa's avatar xo30xoqa
Browse files

Export all types from module

parent a889023b
No related branches found
No related tags found
No related merge requests found
...@@ -23,12 +23,22 @@ using ...@@ -23,12 +23,22 @@ using
TOML TOML
## define exported functions and variables ## define exported functions and variables
#XXX export all types?
export export
#types
LandCover,
EventType,
Pixel,
FarmEvent,
FarmPlot,
Sex,
Animal,
Farmer,
#functions
param, param,
simulate, simulate,
initialise, initialise,
stepsimulation!, stepsimulation!,
createevent!,
finalise finalise
## The file that stores all default parameters ## The file that stores all default parameters
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
landscape = Persephone.initlandscape() landscape = Persephone.initlandscape()
space = GridSpace(size(landscape), periodic=false) space = GridSpace(size(landscape), periodic=false)
properties = Dict{Symbol,Any}(:landscape=>landscape) properties = Dict{Symbol,Any}(:landscape=>landscape)
model = AgentBasedModel(Persephone.FarmPlot, space, properties=properties, model = AgentBasedModel(FarmPlot, space, properties=properties,
rng=Random.Xoshiro(param("core.seed")), warn=false) rng=Random.Xoshiro(param("core.seed")), warn=false)
Persephone.initfields!(model) Persephone.initfields!(model)
# these tests are specific to the Jena maps # these tests are specific to the Jena maps
...@@ -31,13 +31,12 @@ end ...@@ -31,13 +31,12 @@ end
space = GridSpace(size(landscape), periodic=false) space = GridSpace(size(landscape), periodic=false)
properties = Dict{Symbol,Any}(:date=>param("core.startdate"), properties = Dict{Symbol,Any}(:date=>param("core.startdate"),
:landscape=>landscape, :landscape=>landscape,
:events=>Vector{Persephone.FarmEvent}()) :events=>Vector{FarmEvent}())
model = AgentBasedModel(Union{Persephone.Farmer,Persephone.Animal,Persephone.FarmPlot}, model = AgentBasedModel(Union{Farmer,Animal,FarmPlot}, space, properties=properties,
space, properties=properties,
rng=Random.Xoshiro(param("core.seed")), warn=false) rng=Random.Xoshiro(param("core.seed")), warn=false)
# create some events and see whether they show up on the map and disappear as they should # create some events and see whether they show up on the map and disappear as they should
Persephone.createevent!(model, [(1,1), (1,2), (1,3), (2,1), (2,3)], Persephone.tillage) createevent!(model, [(1,1), (1,2), (1,3), (2,1), (2,3)], Persephone.tillage)
Persephone.createevent!(model, [(1,1), (1,2), (1,3), (2,2)], Persephone.sowing, 2) createevent!(model, [(1,1), (1,2), (1,3), (2,2)], Persephone.sowing, 2)
@test model.landscape[1,1].events == [Persephone.tillage, Persephone.sowing] @test model.landscape[1,1].events == [Persephone.tillage, Persephone.sowing]
@test model.landscape[2,1].events == [Persephone.tillage] @test model.landscape[2,1].events == [Persephone.tillage]
@test model.landscape[2,2].events == [Persephone.sowing] @test model.landscape[2,2].events == [Persephone.sowing]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment