File: 02_____destroy.t

package info (click to toggle)
libbit-vector-perl 7.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,008 kB
  • sloc: perl: 6,703; ansic: 3,654; makefile: 9
file content (79 lines) | stat: -rw-r--r-- 1,942 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!perl -w

use strict;
no strict "vars";

use Bit::Vector;

# ======================================================================
#   $set->DESTROY();
# ======================================================================

print "1..15\n";

$n = 1;
$set = 1;
if (ref($set) eq '')
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set->DESTROY(); };
if (($@ =~ /Can't call method "DESTROY" without a package or object reference/) ||
    ($@ =~ /Can't locate object method "DESTROY" via package "1"/))
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Bit::Vector::DESTROY($set); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
$obj = 0x00088850;
$set = \$obj;
if (ref($set) eq 'SCALAR')
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set->DESTROY(); };
if ($@ =~ /Can't call method "DESTROY" on unblessed reference/)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Bit::Vector::DESTROY($set); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
$obj = 0x000E9CE0;
$set = \$obj;
bless($set, 'Bit::Vector');
if (ref($set) eq 'Bit::Vector')
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set->DESTROY(); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { Bit::Vector::DESTROY($set); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
$set = new Bit::Vector(1);
if (ref($set) eq 'Bit::Vector')
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set->DESTROY(); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (ref($set) eq 'Bit::Vector')
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
if (defined(${$set}) && (${$set} == 0))
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set->DESTROY(); };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
eval { $set = 0; };
unless ($@)
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;

__END__