From: Rafael Garcia-Suarez Date: Sat, 3 Mar 2007 18:19:01 +0000 (+0000) Subject: Add missing file from change #30454 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cff384806032116f8dd1c2973e4ce0382e3a339;p=p5sagit%2Fp5-mst-13.2.git Add missing file from change #30454 p4raw-link: @30454 on //depot/perl: caa6400115a38c0669db5e1b28eaa0eb8d1aad26 p4raw-id: //depot/perl@30455 --- diff --git a/ext/Math/BigInt/FastCalc/t/leak.t b/ext/Math/BigInt/FastCalc/t/leak.t new file mode 100644 index 0000000..c7cae8b --- /dev/null +++ b/ext/Math/BigInt/FastCalc/t/leak.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + +# Test for memory leaks from _zero() and friends. + +use Test::More; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, ('../lib', '../blib/arch'); # for running manually + plan tests => 4; + } + +############################################################################# +package Math::BigInt::FastCalc::LeakCheck; +use base qw(Math::BigInt::FastCalc); + +my $destroyed = 0; +sub DESTROY { $destroyed++ } + +############################################################################# +package main; + +for my $method (qw(_zero _one _two _ten)) + { + $destroyed = 0; + { + my $num = Math::BigInt::FastCalc::LeakCheck->$method(); + bless $num, "Math::BigInt::FastCalc::LeakCheck"; + } + is ($destroyed, 1, "$method does not leak memory"); + }