PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/perl5/minherit_runme.pl

#
Perl | 72 lines | 49 code | 20 blank | 3 comment | 0 complexity | 7141f18e9e6eaf603d4d5494500a845e MD5 | raw file
 1#!/usr/bin/perl
 2use strict;
 3use warnings;
 4use Test::More tests => 38;
 5BEGIN { use_ok('minherit') }
 6require_ok('minherit');
 7
 8# adapted from ../python/minherit_runme.py
 9
10my $a = minherit::Foo->new();
11my $b = minherit::Bar->new();
12my $c = minherit::FooBar->new();
13my $d = minherit::Spam->new();
14
15is($a->xget(), 1);
16
17is($b->yget(), 2);
18
19is($c->xget(), 1);
20is($c->yget(), 2);
21is($c->zget(), 3);
22
23is($d->xget(), 1);
24is($d->yget(), 2);
25is($d->zget(), 3);
26is($d->wget(), 4);
27
28is(minherit::xget($a), 1);
29
30is(minherit::yget($b), 2);
31
32is(minherit::xget($c), 1);
33is(minherit::yget($c), 2);
34is(minherit::zget($c), 3);
35
36is(minherit::xget($d), 1);
37is(minherit::yget($d), 2);
38is(minherit::zget($d), 3);
39is(minherit::wget($d), 4);
40
41# Cleanse all of the pointers and see what happens
42
43my $aa = minherit::toFooPtr($a);
44my $bb = minherit::toBarPtr($b);
45my $cc = minherit::toFooBarPtr($c);
46my $dd = minherit::toSpamPtr($d);
47
48is($aa->xget, 1);
49
50is($bb->yget(), 2);
51
52is($cc->xget(), 1);
53is($cc->yget(), 2);
54is($cc->zget(), 3);
55
56is($dd->xget(), 1);
57is($dd->yget(), 2);
58is($dd->zget(), 3);
59is($dd->wget(), 4);
60
61is(minherit::xget($aa), 1);
62
63is(minherit::yget($bb), 2);
64
65is(minherit::xget($cc), 1);
66is(minherit::yget($cc), 2);
67is(minherit::zget($cc), 3);
68
69is(minherit::xget($dd), 1);
70is(minherit::yget($dd), 2);
71is(minherit::zget($dd), 3);
72is(minherit::wget($dd), 4);