From 2947b05c5e91c4d17e642dacac680cae9a50b78d Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Sun, 12 Oct 2025 18:35:10 +0200 Subject: [PATCH 1/3] refactor test suite. --- Project.toml | 11 ---------- docs/src/stopping_criterion.md | 2 +- .../Project.toml | 14 +++++++++++++ .../src/AlgorithmsInterfaceTestSuite.jl | 21 +++++++++++++++++++ test/Project.toml | 18 ++++++++++++++++ test/runtests.jl | 2 +- ...riterion.jl => test_stopping_criterion.jl} | 12 +++-------- 7 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 test/AlgorithmsInterfaceTestSuite.jl/Project.toml create mode 100644 test/AlgorithmsInterfaceTestSuite.jl/src/AlgorithmsInterfaceTestSuite.jl create mode 100644 test/Project.toml rename test/{stopping_criterion.jl => test_stopping_criterion.jl} (91%) diff --git a/Project.toml b/Project.toml index 6cf9f86..1b9bd86 100644 --- a/Project.toml +++ b/Project.toml @@ -7,16 +7,5 @@ version = "0.1.0" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" [compat] -Aqua = "0.8" Dates = "1.10" -SafeTestsets = "0.1" -Test = "1.10" julia = "1.10" - -[extras] -Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[targets] -test = ["Aqua", "Test", "SafeTestsets"] diff --git a/docs/src/stopping_criterion.md b/docs/src/stopping_criterion.md index 6f5917c..4a05b99 100644 --- a/docs/src/stopping_criterion.md +++ b/docs/src/stopping_criterion.md @@ -5,4 +5,4 @@ Modules = [AlgorithmsInterface] Pages = ["stopping_criterion.jl"] Order = [:type, :function] Private = true -``` \ No newline at end of file +``` diff --git a/test/AlgorithmsInterfaceTestSuite.jl/Project.toml b/test/AlgorithmsInterfaceTestSuite.jl/Project.toml new file mode 100644 index 0000000..d16ae49 --- /dev/null +++ b/test/AlgorithmsInterfaceTestSuite.jl/Project.toml @@ -0,0 +1,14 @@ +name = "AlgorithmsInterfaceTestSuite" +uuid = "876e16e5-0a55-4659-a4bc-e03625482f1c" +version = "0.1.0" +authors = ["Ronny Bergmann "] + +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +AlgorithmsInterface = "d1e3940c-cd12-4505-8585-b0a4b322527d" + +[compat] +Test = "1.11.0" + +[sources] +AlgorithmsInterface = {path = "../../"} \ No newline at end of file diff --git a/test/AlgorithmsInterfaceTestSuite.jl/src/AlgorithmsInterfaceTestSuite.jl b/test/AlgorithmsInterfaceTestSuite.jl/src/AlgorithmsInterfaceTestSuite.jl new file mode 100644 index 0000000..ce2bf95 --- /dev/null +++ b/test/AlgorithmsInterfaceTestSuite.jl/src/AlgorithmsInterfaceTestSuite.jl @@ -0,0 +1,21 @@ +""" + AlgorithmsInterfaceTestSuite + +A package to provide dummy algorithms and other test tools for `AlgorithmsInterface.jl`. +""" +module AlgorithmsInterfaceTestSuite + +using AlgorithmsInterface + +struct DummyAlgorithm <: Algorithm + stopping_criterion::StoppingCriterion +end +struct DummyProblem <: Problem end +mutable struct DummyState{S <: StoppingCriterionState} <: State + stopping_criterion_state::S + iteration::Int +end + +export DummyAlgorithm, DummyProblem, DummyState + +end # module AlgorithmsInterfaceTestSuite diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..76e40b7 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,18 @@ +[deps] +AlgorithmsInterface = "d1e3940c-cd12-4505-8585-b0a4b322527d" +AlgorithmsInterfaceTestSuite = "876e16e5-0a55-4659-a4bc-e03625482f1c" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[sources] +AlgorithmsInterface = {path = "../"} +AlgorithmsInterfaceTestSuite = {path = "AlgorithmsInterfaceTestSuite.jl"} + +[compat] +Aqua = "0.8" +SafeTestsets = "0.1" +Test = "1.10" +julia = "1.10" diff --git a/test/runtests.jl b/test/runtests.jl index a6d423f..89874ea 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,7 +9,7 @@ using Dates end @safetestset "Stopping Criteria" begin - include("stopping_criterion.jl") + include("test_stopping_criterion.jl") end @safetestset "Aqua" begin diff --git a/test/stopping_criterion.jl b/test/test_stopping_criterion.jl similarity index 91% rename from test/stopping_criterion.jl rename to test/test_stopping_criterion.jl index 36d5a37..fefb47b 100644 --- a/test/stopping_criterion.jl +++ b/test/test_stopping_criterion.jl @@ -1,15 +1,9 @@ +using Pkg +Pkg.activate(@__DIR__) using Test using AlgorithmsInterface using Dates - -struct DummyAlgorithm <: Algorithm - stopping_criterion::StoppingCriterion -end -struct DummyProblem <: Problem end -mutable struct DummyState{S <: StoppingCriterionState} <: State - stopping_criterion_state::S - iteration::Int -end +using AlgorithmsInterfaceTestSuite problem = DummyProblem() From ea6bb07bd2ce0cf72673e2a1096f772120f1bf11 Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Thu, 16 Oct 2025 14:37:49 +0200 Subject: [PATCH 2/3] Already preview how it looks later, dev both for now until the main package is registered. --- test/AlgorithmsInterfaceTestSuite.jl/Project.toml | 2 +- test/test_stopping_criterion.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/AlgorithmsInterfaceTestSuite.jl/Project.toml b/test/AlgorithmsInterfaceTestSuite.jl/Project.toml index d16ae49..56f6897 100644 --- a/test/AlgorithmsInterfaceTestSuite.jl/Project.toml +++ b/test/AlgorithmsInterfaceTestSuite.jl/Project.toml @@ -8,7 +8,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" AlgorithmsInterface = "d1e3940c-cd12-4505-8585-b0a4b322527d" [compat] -Test = "1.11.0" +Test = "1.10.0" [sources] AlgorithmsInterface = {path = "../../"} \ No newline at end of file diff --git a/test/test_stopping_criterion.jl b/test/test_stopping_criterion.jl index fefb47b..2b43d04 100644 --- a/test/test_stopping_criterion.jl +++ b/test/test_stopping_criterion.jl @@ -1,5 +1,11 @@ using Pkg Pkg.activate(@__DIR__) +if VERSION < v"1.11" + # Once the main package is registered: just load test suite + # Pkg.add(path = (@__DIR__) * "/../", subdir = "test/AlgorithmsInterfaceTestSuite.jl") + Pkg.develop(path = (@__DIR__) * "/../") + Pkg.develop(path = (@__DIR__) * "/AlgorithmsInterfaceTestSuite.jl") +end using Test using AlgorithmsInterface using Dates From 3976ac99c59bf8dab5cba8958b9366455688ecef Mon Sep 17 00:00:00 2001 From: Ronny Bergmann Date: Thu, 16 Oct 2025 14:44:37 +0200 Subject: [PATCH 3/3] Maybe with a resolve? --- test/test_stopping_criterion.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_stopping_criterion.jl b/test/test_stopping_criterion.jl index 2b43d04..38687f3 100644 --- a/test/test_stopping_criterion.jl +++ b/test/test_stopping_criterion.jl @@ -6,6 +6,7 @@ if VERSION < v"1.11" Pkg.develop(path = (@__DIR__) * "/../") Pkg.develop(path = (@__DIR__) * "/AlgorithmsInterfaceTestSuite.jl") end +Pkg.resolve() using Test using AlgorithmsInterface using Dates