Skip to content

Commit

Permalink
extend first test
Browse files Browse the repository at this point in the history
  • Loading branch information
rschwarz committed Dec 16, 2018
1 parent 93218b4 commit dd9bea0
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions test/direct_library_calls.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
# Test raw wrapper with direct library calls

@testset "create small problem and solve" begin
scip__ = Ptr{SCIP.SCIP_}[C_NULL] # SCIP**
scip__ = Ref{Ptr{SCIP.SCIP_}}() # SCIP**
rc = SCIP.SCIPcreate(scip__)
@test rc == SCIP.SCIP_OKAY

scip_ = scip__[1] # SCIP*
@test rc != C_NULL
scip_ = scip__[] # dereference to SCIP*
@test scip_ != C_NULL

# TODO...
rc = SCIP.SCIPincludeDefaultPlugins(scip_)
@test rc == SCIP.SCIP_OKAY

# disable output
rc = SCIP.SCIPsetIntParam(scip_, "display/verblevel", 0)
@test rc == SCIP.SCIP_OKAY

rc = SCIP.SCIPcreateProbBasic(scip_, "")
@test rc == SCIP.SCIP_OKAY

# add variable: x >= 3, objcoef: 1
var__ = Ref{Ptr{SCIP.SCIP_VAR}}()
rc = SCIP.SCIPcreateVarBasic(scip_, var__, "x",
3.0, SCIP.SCIPinfinity(scip_),
1.0, SCIP.SCIP_VARTYPE_CONTINUOUS)
@test rc == SCIP.SCIP_OKAY
var_ = var__[]
@test var_ != C_NULL

rc = SCIP.SCIPsolve(scip_)
@test rc == SCIP.SCIP_OKAY

# check solution value
sol_ = SCIP.SCIPgetBestSol(scip_)
@test sol_ != C_NULL
# val = SCIP.SCIPgetSolVal(scip_, sol_, var_)
# @test val ≈ 3.0

rc = SCIP.SCIPfree(scip__)
@test rc == SCIP.SCIP_OKAY
end

0 comments on commit dd9bea0

Please sign in to comment.