Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage #302

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include("test_problems.jl")
@test VersionNumber(SCS.scs_version(solver)) >= v"3.2.0"
feasible_basic_problems(solver)
test_options(solver)
test_scs_solve_solution_vectors(solver)
end
end

Expand Down
74 changes: 74 additions & 0 deletions test/test_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -786,3 +786,77 @@ function test_options(T)
@test_throws ErrorException SCS.scs_solve(T, args...; write_data_filename = @view tmpf[1:end])
return
end

function test_scs_solve_solution_vectors(solver)
A = reshape([1.0], (1, 1))
P = spzeros(1, 1)
primal_sol = Float64[0.0]
solution = scs_solve(
solver,
1, # m
1, # n
A,
P,
[1.0], # b
[1.0], # c
1, # z
0, # l
Float64[], # bu
Float64[], # bl
Int[], # q
Int[], # s
0, # ep
0, # ed
Float64[], # p
primal_sol,
)
@test ≈(solution.x, [1.0]; atol = 1e-5)
@test solution.x === primal_sol
primal_sol = Float64[]
solution = scs_solve(
solver,
1, # m
1, # n
A,
P,
[1.0], # b
[1.0], # c
1, # z
0, # l
Float64[], # bu
Float64[], # bl
Int[], # q
Int[], # s
0, # ep
0, # ed
Float64[], # p
primal_sol,
)
@test ≈(solution.x, [1.0]; atol = 1e-5)
@test solution.x !== primal_sol
@test isempty(primal_sol)
@test_throws(
ArgumentError,
scs_solve(
solver,
1, # m
1, # n
A,
P,
[1.0], # b
[1.0], # c
1, # z
0, # l
Float64[], # bu
Float64[], # bl
Int[], # q
Int[], # s
0, # ep
0, # ed
Float64[], # p
primal_sol;
warm_start = true,
),
)
return
end
Loading