Python operator_overload runtime testcase cleanup
Remove C test code comment ... this code is in operator_overload.i already
This commit is contained in:
parent
2730ac9c8f
commit
a09ef99606
1 changed files with 0 additions and 79 deletions
|
|
@ -75,82 +75,3 @@ if not -a==a:
|
||||||
if not -b==Op(-5):
|
if not -b==Op(-5):
|
||||||
raise RuntimeError("-b==Op(-5)")
|
raise RuntimeError("-b==Op(-5)")
|
||||||
|
|
||||||
"""
|
|
||||||
/* Sample test code in C++
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc,char** argv)
|
|
||||||
{
|
|
||||||
// test routine:
|
|
||||||
Op a;
|
|
||||||
Op b=5;
|
|
||||||
Op c=b; // copy construct
|
|
||||||
Op d=2;
|
|
||||||
|
|
||||||
// test equality
|
|
||||||
assert(a!=b);
|
|
||||||
assert(b==c);
|
|
||||||
assert(a!=d);
|
|
||||||
|
|
||||||
// test <
|
|
||||||
assert(a<b);
|
|
||||||
assert(a<=b);
|
|
||||||
assert(b<=c);
|
|
||||||
assert(b>=c);
|
|
||||||
assert(b>d);
|
|
||||||
assert(b>=d);
|
|
||||||
|
|
||||||
// test +=
|
|
||||||
Op e=3;
|
|
||||||
e+=d;
|
|
||||||
assert(e==b);
|
|
||||||
e-=c;
|
|
||||||
assert(e==a);
|
|
||||||
e=Op(1);
|
|
||||||
e*=b;
|
|
||||||
assert(e==c);
|
|
||||||
e/=d;
|
|
||||||
assert(e==d);
|
|
||||||
e%=c;
|
|
||||||
assert(e==d);
|
|
||||||
|
|
||||||
// test +
|
|
||||||
Op f(1),g(1);
|
|
||||||
assert(f+g==Op(2));
|
|
||||||
assert(f-g==Op(0));
|
|
||||||
assert(f*g==Op(1));
|
|
||||||
assert(f/g==Op(1));
|
|
||||||
assert(f%g==Op(0));
|
|
||||||
|
|
||||||
// test unary operators
|
|
||||||
assert(!a==true);
|
|
||||||
assert(!b==false);
|
|
||||||
assert(-a==a);
|
|
||||||
assert(-b==Op(-5));
|
|
||||||
|
|
||||||
// test []
|
|
||||||
Op h=3;
|
|
||||||
assert(h[0]==3);
|
|
||||||
assert(h[1]==0);
|
|
||||||
h[0]=2; // set
|
|
||||||
assert(h[0]==2);
|
|
||||||
h[1]=2; // ignored
|
|
||||||
assert(h[0]==2);
|
|
||||||
assert(h[1]==0);
|
|
||||||
|
|
||||||
// test ()
|
|
||||||
Op i=3;
|
|
||||||
assert(i()==3);
|
|
||||||
assert(i(1)==4);
|
|
||||||
assert(i(1,2)==6);
|
|
||||||
|
|
||||||
// plus add some code to check the __str__ fn
|
|
||||||
//assert(str(Op(1))=="Op(1)");
|
|
||||||
//assert(str(Op(-3))=="Op(-3)");
|
|
||||||
|
|
||||||
printf("ok\n");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
"""
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue