One more runtime test case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@11190 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
32e03aa13d
commit
3ab6cb695e
1 changed files with 25 additions and 0 deletions
25
Examples/test-suite/c/operator_overload_runme.c
Normal file
25
Examples/test-suite/c/operator_overload_runme.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "operator_overload/operator_overload_proxy.h"
|
||||
|
||||
#define assert(x,msg) if (!x) { printf("%d: %s\n", x, msg); SWIG_exit(0); }
|
||||
|
||||
SWIG_MAKE_DELETE(delete_Ops, Op);
|
||||
|
||||
int main() {
|
||||
Op_sanity_check();
|
||||
|
||||
Op *op1 = new_Op_i(1), *op2 = new_Op_i(2), *op3 = copy_Op(op1);
|
||||
|
||||
assert(Op_NotEqual(op1, op2), "neq failed");
|
||||
Op_PlusPlusPrefix(op3);
|
||||
assert(Op_EqualEqual(op2, op3), "eqeq failed");
|
||||
assert(Op_GreaterThanEqual(op2, op1), "geq failed");
|
||||
Op_PlusEqual(op3, op1);
|
||||
assert(Op_LessThan(op1, op2) && Op_LessThan(op2, op3), "lt failed");
|
||||
assert(3 == *Op_IndexInto(op3, Op_IndexIntoConst(op2, Op_Functor_pOp(op1))), "[] or () failed");
|
||||
assert(5 == Op_Functor_pOp_i(op3, 2), "f(x) failed");
|
||||
|
||||
delete_Ops(op1, op2, op3, 0);
|
||||
SWIG_exit(0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue