Skip to content

Commit 58380bc

Browse files
authored
Merge pull request #186 from control-toolbox/185-dev-tests
Add tests
2 parents 9c8612f + 0294743 commit 58380bc

7 files changed

Lines changed: 1481 additions & 11 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ docs/site/
2626
# environment.
2727
Manifest.toml
2828

29-
#
30-
reports/
29+
# Local reports (analysis, status reports, previews) should not be tracked
30+
reports/

test/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
1010
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
1111
MadNLPGPU = "d72a61cc-809d-412f-99be-fd81f4b8a598"
1212
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
13+
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
1314
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1415

1516
[compat]
@@ -24,4 +25,6 @@ KernelAbstractions = "0.9"
2425
MadNLP = "0.8"
2526
MadNLPGPU = "0.7"
2627
NLPModels = "0.21"
28+
OrderedCollections = "1.8"
2729
Test = "1.10"
30+
julia = "1.10"

test/runtests.jl

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Test
22
using Aqua
3+
using OrderedCollections: OrderedDict
34
import CTParser:
45
CTParser,
56
subs,
@@ -57,16 +58,69 @@ macro ignore(e)
5758
return :()
5859
end
5960

60-
@testset verbose = true showtiming = true "CTParser tests" begin
61-
for name in (
62-
:aqua,
63-
:utils,
64-
:prefix,
65-
:onepass_fun,
66-
:onepass_exa,
67-
:initial_guess,
61+
const VERBOSE = true
62+
const SHOWTIMING = true
63+
64+
"""Return the default set of tests enabled for CTParser."""
65+
function default_tests()
66+
return OrderedDict(
67+
:aqua => true,
68+
:utils => true,
69+
:utils_bis => true,
70+
:prefix => true,
71+
:prefix_bis => true,
72+
:onepass_fun => true,
73+
:onepass_fun_bis => true,
74+
:onepass_exa => true,
75+
:onepass_exa_bis => true,
6876
)
69-
#for name ∈ (:onepass_exa,)
77+
end
78+
79+
const TEST_SELECTIONS = isempty(ARGS) ? Symbol[] : Symbol.(ARGS)
80+
81+
function selected_tests()
82+
tests = default_tests()
83+
sels = TEST_SELECTIONS
84+
85+
# No selection: use defaults
86+
if isempty(sels)
87+
return tests
88+
end
89+
90+
# Single :all selection: enable everything
91+
if length(sels) == 1 && sels[1] == :all
92+
for k in keys(tests)
93+
tests[k] = true
94+
end
95+
return tests
96+
end
97+
98+
# Otherwise, start with everything disabled
99+
for k in keys(tests)
100+
tests[k] = false
101+
end
102+
103+
# Enable explicit selections
104+
for sel in sels
105+
if sel == :all
106+
for k in keys(tests)
107+
tests[k] = true
108+
end
109+
break
110+
end
111+
if haskey(tests, sel)
112+
tests[sel] = true
113+
end
114+
end
115+
116+
return tests
117+
end
118+
119+
const SELECTED_TESTS = selected_tests()
120+
121+
@testset verbose = VERBOSE showtiming = SHOWTIMING "CTParser tests" begin
122+
for (name, enabled) in SELECTED_TESTS
123+
enabled || continue
70124
@testset "$(name)" begin
71125
test_name = Symbol(:test_, name)
72126
include("$(test_name).jl")

0 commit comments

Comments
 (0)