From a908adcbb638b267000ef67ffba80930cce653e9 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 12 Feb 2024 11:33:17 +0000 Subject: [PATCH] brute force chances for TestItemRunner --- EpiAware/test/runtests.jl | 10 ++-------- EpiAware/test/test_epimodel.jl | 6 +++--- EpiAware/test/test_latent-processes.jl | 4 ++-- EpiAware/test/test_utilities.jl | 20 ++++++++++---------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/EpiAware/test/runtests.jl b/EpiAware/test/runtests.jl index 2e04ef92d..b9e874db1 100644 --- a/EpiAware/test/runtests.jl +++ b/EpiAware/test/runtests.jl @@ -1,9 +1,3 @@ -using Test -using EpiAware -using Distributions -using LinearAlgebra -using Turing, DynamicPPL +using TestItemRunner -include("test_utilities.jl") -include("test_epimodel.jl") -include("test_latent-processes.jl") +@run_package_tests diff --git a/EpiAware/test/test_epimodel.jl b/EpiAware/test/test_epimodel.jl index af7ef7e81..0354361c6 100644 --- a/EpiAware/test/test_epimodel.jl +++ b/EpiAware/test/test_epimodel.jl @@ -1,5 +1,5 @@ -@testset "EpiModel constructor" begin +@testitem "EpiModel constructor" begin gen_int = [0.2, 0.3, 0.5] delay_int = [0.1, 0.4, 0.5] cluster_coeff = 0.8 @@ -19,7 +19,7 @@ @test size(model.delay_kernel) == (time_horizon, time_horizon) end -@testset "EpiModel constructor" begin +@testitem "EpiModel constructor" begin gen_int = [0.2, 0.3, 0.5] delay_int = [0.1, 0.4, 0.5] cluster_coeff = 0.8 @@ -39,7 +39,7 @@ end @test size(model.delay_kernel) == (time_horizon, time_horizon) end -@testset "EpiModel function" begin +@testitem "EpiModel function" begin recent_incidence = [10, 20, 30] Rt = 1.5 diff --git a/EpiAware/test/test_latent-processes.jl b/EpiAware/test/test_latent-processes.jl index a73cc1a3c..277c3663e 100644 --- a/EpiAware/test/test_latent-processes.jl +++ b/EpiAware/test/test_latent-processes.jl @@ -1,8 +1,8 @@ -@testset "Testing random_walk function" begin +@testitem "Testing random_walk function" begin # Test case 1: Testing against theoretical properties - @testset "Test case 1" begin + @testitem "Test case 1" begin n = 5 model = random_walk(n) fixed_model = fix(model, (σ²_RW = 1.0,)) #Fixing the standard deviation of the random walk process diff --git a/EpiAware/test/test_utilities.jl b/EpiAware/test/test_utilities.jl index 53df62a03..135413e9a 100644 --- a/EpiAware/test/test_utilities.jl +++ b/EpiAware/test/test_utilities.jl @@ -1,4 +1,4 @@ -@testset "Testing scan function with addition" begin +@testitem "Testing scan function with addition" begin # Test case 1: Testing with addition function function add(a, b) return a + b, a + b @@ -12,7 +12,7 @@ @test carry == expected_carry end -@testset "Testing scan function with multiplication" begin +@testitem "Testing scan function with multiplication" begin # Test case 2: Testing with multiplication function function multiply(a, b) return a * b, a * b @@ -27,26 +27,26 @@ end @test carry == expected_carry end -@testset "Testing create_discrete_pmf function" begin +@testitem "Testing create_discrete_pmf function" begin # Test case 1: Testing with a non-negative distribution - @testset "Test case 1" begin + @testitem "Test case 1" begin dist = Normal() @test_throws AssertionError create_discrete_pmf(dist, Δd = 1.0, D = 3.0) end # Test case 2: Testing with Δd = 0.0 - @testset "Test case 2" begin + @testitem "Test case 2" begin dist = Exponential(1.0) @test_throws AssertionError create_discrete_pmf(dist, Δd = 0.0, D = 3.0) end - @testset "Test case 3" begin + @testitem "Test case 3" begin dist = Exponential(1.0) @test_throws AssertionError create_discrete_pmf(dist, Δd = 3.0, D = 1.0) end # Test case 4: Testing output against expected PMF - @testset "Test case 4" begin + @testitem "Test case 4" begin dist = Exponential(1.0) expected_pmf = [(exp(-(t - 1)) - exp(-t)) / (1 - exp(-5)) for t = 1:5] pmf = create_discrete_pmf(dist, Δd = 1.0, D = 5.0) @@ -55,9 +55,9 @@ end end -@testset "Testing growth_rate_to_reproductive_ratio function" begin +@testitem "Testing growth_rate_to_reproductive_ratio function" begin #Test that zero exp growth rate imples R0 = 1 - @testset "Test case 1" begin + @testitem "Test case 1" begin r = 0 w = ones(5) |> x -> x ./ sum(x) expected_ratio = 1 @@ -66,7 +66,7 @@ end end #Test MethodError when w is not a vector - @testset "Test case 2" begin + @testitem "Test case 2" begin r = 0 w = 1 @test_throws MethodError growth_rate_to_reproductive_ratio(r, w)