Skip to content
Snippets Groups Projects
Commit 671cdb60 authored by Marco Matthies's avatar Marco Matthies
Browse files

Rearrange weather unit tests

parent 69ee3eb9
Branches
Tags
No related merge requests found
...@@ -64,7 +64,7 @@ end ...@@ -64,7 +64,7 @@ end
@test Ps.distancetoedge((6,6), model) == 20m @test Ps.distancetoedge((6,6), model) == 20m
end end
@testset "Weather initialisation" begin @testset "Weather interface" begin
# these tests are specific to the Jena weather file # these tests are specific to the Jena weather file
model = inittestmodel() model = inittestmodel()
@test length(model.weather) == 59 @test length(model.weather) == 59
......
...@@ -92,6 +92,9 @@ end ...@@ -92,6 +92,9 @@ end
include("landscape_tests.jl") include("landscape_tests.jl")
include("simulation_tests.jl") include("simulation_tests.jl")
end end
@testset "Weather model" begin
include("weather_tests.jl")
end
@testset "Nature model" begin @testset "Nature model" begin
include("nature_tests.jl") include("nature_tests.jl")
end end
......
@testset "Constructor and interface" begin
float3 = [0.0, 1.0, 2.0]
missing3 = Union{Missing,Float64}[missing, missing, missing]
weather = Weather(; firstdate = Date("2000-01-01"),
lastdate = Date("2000-01-03"),
windspeed = missing3,
precipitation = float3,
sunshine = missing3,
cloudcover = missing3,
humidity = missing3,
meantemp = float3,
maxtemp = float3,
mintemp = float3,
evapotranspiration = float3)
date = Date("2000-01-02")
@test length(weather) == 3
@test Ps.daynumber(weather, date) == 2
@test Ps.windspeed(weather, date) |> ismissing
@test Ps.precipitation(weather, date) == 1.0
@test Ps.sunshine(weather, date) |> ismissing
@test Ps.humidity(weather, date) |> ismissing
@test Ps.meantemp(weather, date) == 1.0
@test Ps.maxtemp(weather, date) == 1.0
@test Ps.mintemp(weather, date) == 1.0
@test Ps.evapotranspiration(weather, date) == 1.0
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment