From a29c565404401dc8fce1ae726366d9b5cd4bf308 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 08:57:38 +0200 Subject: [PATCH 1/6] Increase sample size when testing empirical moments of DiscreteNonParametric --- test/univariate/locationscale.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/univariate/locationscale.jl b/test/univariate/locationscale.jl index c4876e197..08d8dc384 100644 --- a/test/univariate/locationscale.jl +++ b/test/univariate/locationscale.jl @@ -110,7 +110,7 @@ function test_location_scale( @test invlogccdf(dtest, log(0.5)) ≈ invlogccdf(dref, log(0.5)) @test invlogccdf(dtest, log(0.8)) ≈ invlogccdf(dref, log(0.8)) - r = Array{float(eltype(dtest))}(undef, 100000) + r = Array{float(eltype(dtest))}(undef, 200000) if ismissing(rng) rand!(dtest, r) else @@ -148,7 +148,7 @@ end rng = MersenneTwister(123) @testset "Normal" begin - for _rng in (missing, rng), sign in (1, -1) + @testset "_rng=$_rng, sign=$sign" for _rng in (missing, rng), sign in (1, -1) test_location_scale_normal(_rng, 0.3, sign * 0.2, 0.1, 0.2) test_location_scale_normal(_rng, -0.3, sign * 0.1, -0.1, 0.3) test_location_scale_normal(_rng, 1.3, sign * 0.4, -0.1, 0.5) @@ -156,11 +156,11 @@ end test_location_scale_normal(rng, ForwardDiff.Dual(0.3), 0.2, 0.1, 0.2) end @testset "DiscreteNonParametric" begin - probs = normalize!(rand(10), 1) - for _rng in (missing, rng), sign in (1, -1) - test_location_scale_discretenonparametric(_rng, 1//3, sign * 1//2, 1:10, probs) - test_location_scale_discretenonparametric(_rng, -1//4, sign * 1//3, (-10):(-1), probs) - test_location_scale_discretenonparametric(_rng, 6//5, sign * 3//2, 15:24, probs) + _probs = normalize!(rand(10), 1) + @testset "_rng=$_rng, sign=$sign" for _rng in (missing, rng), sign in (1, -1) + test_location_scale_discretenonparametric(_rng, 1//3, sign * 1//2, 1:10, _probs) + test_location_scale_discretenonparametric(_rng, -1//4, sign * 1//3, (-10):(-1), _probs) + test_location_scale_discretenonparametric(_rng, 6//5, sign * 3//2, 15:24, _probs) end end From 0e687c73a76c50cfb97297cfb3a3ee67944c1b9e Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 09:05:55 +0200 Subject: [PATCH 2/6] Use StableRNGs for semicircle.jl to avoid breakage on 1.11-beta --- test/univariate/continuous/semicircle.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/univariate/continuous/semicircle.jl b/test/univariate/continuous/semicircle.jl index 8dbf2ff2c..9fe0a9335 100644 --- a/test/univariate/continuous/semicircle.jl +++ b/test/univariate/continuous/semicircle.jl @@ -1,5 +1,5 @@ using Distributions -using Random: MersenneTwister +using StableRNGs using Test d = Semicircle(2.0) @@ -39,8 +39,8 @@ d = Semicircle(2.0) @test quantile(d, .5) == .0 @test quantile(d, 1.0) == +2.0 -rng = MersenneTwister(0) -for r in rand(rng, Uniform(0,10), 5) +rng = StableRNG(123) +@testset "r=$r" for r in rand(rng, Uniform(0,10), 5) N = 10^4 semi = Semicircle(r) sample = rand(rng, semi, N) From da006cb0b52ae67553bd6b2971ab3d4a5734513d Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 09:13:02 +0200 Subject: [PATCH 3/6] Run CI on all PRs. Also CI for workflow_dispatch and merge_group --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9d791e205..2a4b30218 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,12 +2,12 @@ name: CI on: pull_request: - branches: - - master push: branches: - master tags: '*' + workflow_dispatch: + merge_group: concurrency: # Skip intermediate builds: always. From 34628514399709128e064453c18c76be08692d22 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 17:31:25 +0200 Subject: [PATCH 4/6] Update semicircle.jl Co-authored-by: David Widmann --- test/univariate/continuous/semicircle.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/univariate/continuous/semicircle.jl b/test/univariate/continuous/semicircle.jl index 9fe0a9335..7079aa949 100644 --- a/test/univariate/continuous/semicircle.jl +++ b/test/univariate/continuous/semicircle.jl @@ -40,7 +40,7 @@ d = Semicircle(2.0) @test quantile(d, 1.0) == +2.0 rng = StableRNG(123) -@testset "r=$r" for r in rand(rng, Uniform(0,10), 5) +@testset for r in rand(rng, Uniform(0,10), 5) N = 10^4 semi = Semicircle(r) sample = rand(rng, semi, N) From a0a7aa29c6fb1369615e8b040f8386b4e36a4dc7 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 17:31:32 +0200 Subject: [PATCH 5/6] Update locationscale.jl Co-authored-by: David Widmann --- test/univariate/locationscale.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/univariate/locationscale.jl b/test/univariate/locationscale.jl index 08d8dc384..e70e47cde 100644 --- a/test/univariate/locationscale.jl +++ b/test/univariate/locationscale.jl @@ -148,7 +148,7 @@ end rng = MersenneTwister(123) @testset "Normal" begin - @testset "_rng=$_rng, sign=$sign" for _rng in (missing, rng), sign in (1, -1) + @testset for _rng in (missing, rng), sign in (1, -1) test_location_scale_normal(_rng, 0.3, sign * 0.2, 0.1, 0.2) test_location_scale_normal(_rng, -0.3, sign * 0.1, -0.1, 0.3) test_location_scale_normal(_rng, 1.3, sign * 0.4, -0.1, 0.5) From 57daf6a01f3d861733328ecdd573370e06ac0222 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Mon, 27 May 2024 17:31:38 +0200 Subject: [PATCH 6/6] Update locationscale.jl Co-authored-by: David Widmann --- test/univariate/locationscale.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/univariate/locationscale.jl b/test/univariate/locationscale.jl index e70e47cde..5d5f9640b 100644 --- a/test/univariate/locationscale.jl +++ b/test/univariate/locationscale.jl @@ -157,7 +157,7 @@ end end @testset "DiscreteNonParametric" begin _probs = normalize!(rand(10), 1) - @testset "_rng=$_rng, sign=$sign" for _rng in (missing, rng), sign in (1, -1) + @testset for _rng in (missing, rng), sign in (1, -1) test_location_scale_discretenonparametric(_rng, 1//3, sign * 1//2, 1:10, _probs) test_location_scale_discretenonparametric(_rng, -1//4, sign * 1//3, (-10):(-1), _probs) test_location_scale_discretenonparametric(_rng, 6//5, sign * 3//2, 15:24, _probs)