Skip to content

Commit

Permalink
Split test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed Sep 29, 2024
1 parent 1dc2dfb commit fcc0ad8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.test_suite }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -21,8 +21,8 @@ jobs:
- "1.9"
- "1"
test_suite:
- "normal"
- "hmmbase"
- "Standard"
- "HMMBase"
env:
JULIA_HMM_TEST_SUITE: ${{ matrix.test_suite }}
steps:
Expand Down
1 change: 0 additions & 1 deletion libs/HMMTest/ext/HMMTestHMMBaseExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,4 @@ function HMMTest.test_identical_hmmbase(
end
end


end
10 changes: 5 additions & 5 deletions test/correctness.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ seq_ends = cumsum(length.(control_seqs));
hmm = HMM(init, trans, dists)
hmm_guess = HMM(init_guess, trans_guess, dists_guess)

test_identical_hmmbase(rng, hmm, T; hmm_guess)
TEST_SUITE == "HMMBase" && test_identical_hmmbase(rng, hmm, T; hmm_guess)
test_coherent_algorithms(rng, hmm, control_seq; seq_ends, hmm_guess, init=false)
test_type_stability(rng, hmm, control_seq; seq_ends, hmm_guess)
test_allocations(rng, hmm, control_seq; seq_ends, hmm_guess)
Expand All @@ -57,7 +57,7 @@ end
hmm = HMM(init, trans, dists)
hmm_guess = HMM(init_guess, trans_guess, dists_guess)

test_identical_hmmbase(rng, hmm, T; hmm_guess)
TEST_SUITE == "HMMBase" && test_identical_hmmbase(rng, hmm, T; hmm_guess)
test_coherent_algorithms(rng, hmm, control_seq; seq_ends, hmm_guess, init=false)
test_type_stability(rng, hmm, control_seq; seq_ends, hmm_guess)
end
Expand Down Expand Up @@ -93,7 +93,7 @@ end
hmm = HMM(init, sparse(trans), dists)
hmm_guess = HMM(init_guess, trans_guess, dists_guess)

test_identical_hmmbase(rng, hmm, T; hmm_guess)
TEST_SUITE == "HMMBase" && test_identical_hmmbase(rng, hmm, T; hmm_guess)
test_coherent_algorithms(rng, hmm, control_seq; seq_ends, hmm_guess, init=false)
test_type_stability(rng, hmm, control_seq; seq_ends, hmm_guess)
@test_skip test_allocations(rng, hmm, control_seq; seq_ends, hmm_guess)
Expand All @@ -106,7 +106,7 @@ end
hmm = transpose_hmm(HMM(init, trans, dists))
hmm_guess = transpose_hmm(HMM(init_guess, trans_guess, dists_guess))

test_identical_hmmbase(rng, hmm, T; hmm_guess)
TEST_SUITE == "HMMBase" && test_identical_hmmbase(rng, hmm, T; hmm_guess)
test_coherent_algorithms(rng, hmm, control_seq; seq_ends, hmm_guess, init=false)
test_type_stability(rng, hmm, control_seq; seq_ends, hmm_guess)
test_allocations(rng, hmm, control_seq; seq_ends, hmm_guess)
Expand All @@ -119,6 +119,6 @@ end
hmm = HMM(init, trans, dists)
hmm_guess = HMM(init_guess, trans_guess, dists_guess)

test_identical_hmmbase(rng, hmm, T; hmm_guess)
TEST_SUITE == "HMMBase" && test_identical_hmmbase(rng, hmm, T; hmm_guess)
test_coherent_algorithms(rng, hmm, control_seq; seq_ends, hmm_guess, init=false)
end
57 changes: 32 additions & 25 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,48 @@ using JuliaFormatter: JuliaFormatter
using Pkg
using Test

TEST_SUITE = get(ENV, "JULIA_HMM_TEST_SUITE", "Standard")
if TEST_SUITE == "HMMBase"
Pkg.add("HMMBase")
end

Pkg.develop(; path=joinpath(dirname(@__DIR__), "libs", "HMMTest"))

@testset verbose = true "HiddenMarkovModels.jl" begin
@testset "Code formatting" begin
@test JuliaFormatter.format(HiddenMarkovModels; verbose=false, overwrite=false)
end
if TEST_SUITE == "Standard"
@testset "Code formatting" begin
@test JuliaFormatter.format(HiddenMarkovModels; verbose=false, overwrite=false)
end

@testset "Code quality" begin
Aqua.test_all(
HiddenMarkovModels; ambiguities=false, deps_compat=(check_extras=false,)
)
end
@testset "Code quality" begin
Aqua.test_all(
HiddenMarkovModels; ambiguities=false, deps_compat=(check_extras=false,)
)
end

@testset "Code linting" begin
using Distributions
using Zygote
JET.test_package(HiddenMarkovModels; target_defined_modules=true)
end
@testset "Code linting" begin
using Distributions
using Zygote
JET.test_package(HiddenMarkovModels; target_defined_modules=true)
end

@testset "Distributions" begin
include("distributions.jl")
end
@testset "Distributions" begin
include("distributions.jl")
end

@testset "Correctness" begin
include("correctness.jl")
end
examples_path = joinpath(dirname(@__DIR__), "examples")
for file in readdir(examples_path)
@testset "Example - $file" begin
include(joinpath(examples_path, file))
end
end

examples_path = joinpath(dirname(@__DIR__), "examples")
for file in readdir(examples_path)
@testset "Example - $file" begin
include(joinpath(examples_path, file))
@testset "Doctests" begin
Documenter.doctest(HiddenMarkovModels)
end
end

@testset "Doctests" begin
Documenter.doctest(HiddenMarkovModels)
@testset "Correctness - $TEST_SUITE" begin
include("correctness.jl")
end
end

0 comments on commit fcc0ad8

Please sign in to comment.