Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
8fc84186
Commit
8fc84186
authored
2 years ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Wrote basic I/O tests
parent
3a702e24
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/io_tests.jl
+24
-1
24 additions, 1 deletion
test/io_tests.jl
test/runtests.jl
+4
-1
4 additions, 1 deletion
test/runtests.jl
test/test_parameters.toml
+2
-1
2 additions, 1 deletion
test/test_parameters.toml
with
30 additions
and
3 deletions
test/io_tests.jl
+
24
−
1
View file @
8fc84186
...
@@ -3,4 +3,27 @@
...
@@ -3,4 +3,27 @@
### This tests the core input and output functions.
### This tests the core input and output functions.
###
###
#TODO
@testset
"Model configuration"
begin
# `test_parameters.toml` is read in in `runtests.jl`
@test
param
(
"core.configfile"
)
==
TESTPARAMETERS
@test
param
(
"core.startdate"
)
==
Date
(
2020
,
1
,
1
)
@test
param
(
"nature.targetspecies"
)
==
[
"Wolpertinger"
,
"Wyvern"
]
#TODO test commandline parameters
end
@testset
"Output functions"
begin
# test that the output directory is created with all files
logstring
=
"Setting up output directory results_testsuite_
$
(Dates.today())_s1"
@test_logs
(
:
info
,
logstring
)
Persephone
.
setupdatadir
()
@test
isdir
(
param
(
"core.outdir"
))
@test
isfile
(
joinpath
(
param
(
"core.outdir"
),
param
(
"core.landcovermap"
)))
@test
isfile
(
joinpath
(
param
(
"core.outdir"
),
param
(
"core.farmfieldsmap"
)))
@test
isfile
(
joinpath
(
param
(
"core.outdir"
),
param
(
"core.configfile"
)))
@test
isfile
(
joinpath
(
param
(
"core.outdir"
),
Persephone
.
LOGFILE
))
# check whether the overwrite warning/protection works
logstring
=
"Overwriting existing output directory
$
(param("
core
.
outdir
"))."
@test_logs
(
:
warn
,
logstring
)
match_mode
=:
any
Persephone
.
setupdatadir
()
#TODO test overwrite protection (requires parameter mutability)
rm
(
param
(
"core.outdir"
),
force
=
true
,
recursive
=
true
)
#TODO test that creating a DataOutput works, and outputs data with the required frequency
end
This diff is collapsed.
Click to expand it.
test/runtests.jl
+
4
−
1
View file @
8fc84186
...
@@ -9,10 +9,13 @@ Pkg.activate("..")
...
@@ -9,10 +9,13 @@ Pkg.activate("..")
using
Persephone
using
Persephone
using
Test
using
Test
using
Random
using
Random
using
Dates
using
Agents
using
Agents
const
TESTPARAMETERS
=
"test_parameters.toml"
@testset
"Persephone Tests"
begin
@testset
"Persephone Tests"
begin
Persephone
.
initsettings
(
"test_parameters.toml"
)
Persephone
.
initsettings
(
TESTPARAMETERS
)
@testset
"Core model"
begin
@testset
"Core model"
begin
include
(
"io_tests.jl"
)
include
(
"io_tests.jl"
)
include
(
"landscape_tests.jl"
)
include
(
"landscape_tests.jl"
)
...
...
This diff is collapsed.
Click to expand it.
test/test_parameters.toml
+
2
−
1
View file @
8fc84186
...
@@ -8,7 +8,8 @@ configfile = "test_parameters.toml" # location of the configuration file
...
@@ -8,7 +8,8 @@ configfile = "test_parameters.toml" # location of the configuration file
landcovermap
=
"landcover_jena.tif"
# location of the landcover map
landcovermap
=
"landcover_jena.tif"
# location of the landcover map
farmfieldsmap
=
"fields_jena.tif"
# location of the field geometry map
farmfieldsmap
=
"fields_jena.tif"
# location of the field geometry map
outdir
=
"results_testsuite"
# location and name of the output folder
outdir
=
"results_testsuite"
# location and name of the output folder
loglevel
=
"debug"
# verbosity level: "debug", "info", "quiet"
overwrite
=
true
# overwrite the output directory? (true/false/"ask")
loglevel
=
"info"
# verbosity level: "debug", "info", "quiet"
seed
=
1
# seed value for the RNG (0 -> random value)
seed
=
1
# seed value for the RNG (0 -> random value)
# dates to start and end the simulation
# dates to start and end the simulation
startdate
=
2020-01-01
startdate
=
2020-01-01
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment