File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,15 @@ const SCIP_ = LibSCIP.SCIP
5
5
const TRUE = LibSCIP. TRUE
6
6
const FALSE = LibSCIP. FALSE
7
7
8
- # SCIP_CALL: macro to check return codes, inspired by @assert
8
+ # SCIP_CALL: macro to check return codes
9
9
macro SCIP_CALL (ex)
10
- return :(@assert $ (esc (ex)) == SCIP_OKAY)
10
+ quote
11
+ v = $ (esc (ex))
12
+ if v != SCIP_OKAY
13
+ s = $ (string (ex))
14
+ error (" $s yielded SCIP code $v " )
15
+ end
16
+ end
11
17
end
12
18
13
19
const SCIP_STATISTICS_FUNCS = [
Original file line number Diff line number Diff line change 80
80
end
81
81
82
82
include (" MOI_conshdlr.jl" )
83
+
84
+ using Test
85
+ using SCIP
86
+
87
+ @testset " SCIP_CALL printing" begin
88
+ f () = SCIP. SCIP_OKAY
89
+ g (args... ) = SCIP. SCIP_ERROR
90
+ SCIP. @SCIP_CALL f ()
91
+ h () = SCIP. @SCIP_CALL (g (1 , 2 ))
92
+ @test_throws ErrorException (" g() yielded SCIP code SCIP_ERROR" ) SCIP. @SCIP_CALL g ()
93
+ @test_throws ErrorException (" g(1, 2) yielded SCIP code SCIP_ERROR" ) h ()
94
+ end
You can’t perform that action at this time.
0 commit comments