Skip to content

Commit 1880f23

Browse files
committed
add missing test
1 parent 2a73fce commit 1880f23

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

src/ModelAnalyzer.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ function summarize(io::IO, issue::AbstractIssue; verbose = true)
8080
end
8181
end
8282

83+
const DEFAULT_MAX_ISSUES = 10
84+
8385
function summarize(
8486
io::IO,
8587
issues::Vector{T};
8688
verbose = true,
87-
max_issues = 10,
89+
max_issues = DEFAULT_MAX_ISSUES,
8890
) where {T<:AbstractIssue}
8991
summarize(io, T, verbose = verbose)
9092
print(io, "\n## Number of issues\n\n")
@@ -95,7 +97,7 @@ function summarize(
9597
io,
9698
"Showing first ",
9799
max_issues,
98-
" issues " * "($(length(issues) - max_issues) issues ommitted)\n\n",
100+
" issues ($(length(issues) - max_issues) issues ommitted)\n\n",
99101
)
100102
end
101103
for issue in first(issues, max_issues)

src/feasibility.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ function ModelAnalyzer.summarize(
685685
io::IO,
686686
data::Data;
687687
verbose = true,
688-
max_issues = typemax(Int),
688+
max_issues = ModelAnalyzer.DEFAULT_MAX_ISSUES,
689689
configurations = true,
690690
)
691691
print(io, "## Feasibility Analysis\n\n")

src/infeasibility.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ function ModelAnalyzer.summarize(
677677
io::IO,
678678
data::Data;
679679
verbose = true,
680-
max_issues = typemax(Int),
680+
max_issues = ModelAnalyzer.DEFAULT_MAX_ISSUES,
681681
)
682682
print(io, "## Infeasibility Analysis\n\n")
683683

src/numerical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ function ModelAnalyzer.summarize(
20422042
io::IO,
20432043
data::Data;
20442044
verbose = true,
2045-
max_issues = typemax(Int),
2045+
max_issues = ModelAnalyzer.DEFAULT_MAX_ISSUES,
20462046
configurations = true,
20472047
dimensions = true,
20482048
ranges = true,

test/numerical.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,27 @@ function test_qp_range()
995995
return
996996
end
997997

998+
function test_more_than_max_issues()
999+
model = Model()
1000+
@variable(model, xg[1:20] <= 2e9)
1001+
data = ModelAnalyzer.analyze(ModelAnalyzer.Numerical.Analyzer(), model)
1002+
list = ModelAnalyzer.list_of_issue_types(data)
1003+
@test length(list) >= 1
1004+
ret = ModelAnalyzer.list_of_issues(
1005+
data,
1006+
ModelAnalyzer.Numerical.LargeBoundCoefficient,
1007+
)
1008+
@test length(ret) == 20
1009+
1010+
buf = IOBuffer()
1011+
ModelAnalyzer.summarize(buf, data)
1012+
str = String(take!(buf))
1013+
@test occursin("Showing first ", str)
1014+
@test occursin(" issues ommitted)\n\n", str)
1015+
1016+
return
1017+
end
1018+
9981019
end # module
9991020

10001021
TestNumerical.runtests()

0 commit comments

Comments
 (0)