new operator overload tests to locate bugs in pre- increment/decrement operators
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10338 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
128880ea1d
commit
ad93f971ca
3 changed files with 90 additions and 0 deletions
38
Examples/test-suite/perl5/operator_overload_break_runme.pl
Normal file
38
Examples/test-suite/perl5/operator_overload_break_runme.pl
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use operator_overload_break;
|
||||
|
||||
# Workaround for
|
||||
# ok( not (expression) , "test description" );
|
||||
# does not working in older versions of Perl, eg 5.004_04
|
||||
sub ok_not ($;$) {
|
||||
my($test, $name) = @_;
|
||||
$test = not $test;
|
||||
ok($test, $name);
|
||||
}
|
||||
|
||||
pass("loaded");
|
||||
|
||||
my $op = operator_overload_break::Op->new(5);
|
||||
|
||||
isa_ok($op, "operator_overload_break::Op");
|
||||
|
||||
ok((2 == $op - 3),
|
||||
"subtraction");
|
||||
|
||||
$op->{k} = 37;
|
||||
|
||||
ok((40 == $op + 3),
|
||||
"addition");
|
||||
|
||||
($op + 3)->Print();
|
||||
|
||||
$op->{k} = 22;
|
||||
|
||||
ok((10 == (32 - $op)),
|
||||
"reversed subtraction");
|
||||
|
||||
ok_not((3 == $op),
|
||||
'not equal');
|
||||
Loading…
Add table
Add a link
Reference in a new issue