diff --git a/test/runtests.jl b/test/runtests.jl index 510e5cc9..e9f41d94 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,3 +1,4 @@ +using MimiFUND using Mimi using Test using DataFrames @@ -11,15 +12,12 @@ using CSVFiles @testset "fund-model" begin -include("../src/fund.jl") -using .Fund - #default model exported by fund module global default_nsteps = 1050 global m = getfund() run(m) @test Mimi.time_labels(m) == collect(1950:1:1950+default_nsteps) - + #default model created by getfund() global m1 = getfund() run(m1) @@ -39,9 +37,6 @@ end #fund-model testset Mimi.reset_compdefs() -include("../src/fund.jl") -using .Fund - global m = getfund() run(m) @@ -52,14 +47,14 @@ err_array = 0.0 for c in map(name, Mimi.compdefs(m)), v in Mimi.variable_names(m, c) #load data for comparison - filename = joinpath(@__DIR__, "../contrib/validation_data_v040/$c-$v.csv") + filename = joinpath(@__DIR__, "../contrib/validation_data_v040/$c-$v.csv") results = m[c, v] df = load(filename) |> DataFrame if typeof(results) <: Number validation_results = df[1,1] @test results ≈ validation_results atol = err_number #slight imprecision with these values due to rounding - + else validation_results = convert(Array, df) @@ -71,9 +66,9 @@ for c in map(name, Mimi.compdefs(m)), v in Mimi.variable_names(m, c) if size(validation_results,1) == 1 validation_results = validation_results' end - + @test results ≈ validation_results atol = err_array - + end end @@ -83,7 +78,7 @@ end #fund-integration testset # 3. Test marginal damages functions (test that each function does not error) #------------------------------------------------------------------------------ -@testset "test-marginaldamages" begin +@testset "test-marginaldamages" begin include("../src/marginaldamages.jl") md = getmarginaldamages() @@ -102,7 +97,7 @@ end #marginaldamages testset # 4. Run basic test of MCS functionality #------------------------------------------------------------------------------ -@testset "test-mcs" begin +@testset "test-mcs" begin include("../src/montecarlo/run_fund_mcs.jl") include("../src/montecarlo/run_fund_scc_mcs.jl")