remove extraneous garbage from tests
[gitmo/Class-C3.git] / t / 04_MRO.t
CommitLineData
d401eda1 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
ef29cd70 6use Test::More tests => 1;
d401eda1 7
8=pod
9
10example taken from: L<http://gauss.gwydiondylan.org/books/drm/drm_50.html>
11
12 Object
13 ^
14 |
15 LifeForm
16 ^ ^
17 / \
18 Sentient BiPedal
19 ^ ^
20 | |
21 Intelligent Humanoid
22 ^ ^
23 \ /
24 Vulcan
25
26 define class <sentient> (<life-form>) end class;
27 define class <bipedal> (<life-form>) end class;
28 define class <intelligent> (<sentient>) end class;
29 define class <humanoid> (<bipedal>) end class;
30 define class <vulcan> (<intelligent>, <humanoid>) end class;
31
32=cut
33
34{
35 package Object;
ef29cd70 36 use Class::C3;
d401eda1 37
38 package LifeForm;
ef29cd70 39 use Class::C3;
d401eda1 40 use base 'Object';
41
42 package Sentient;
ef29cd70 43 use Class::C3;
d401eda1 44 use base 'LifeForm';
45
46 package BiPedal;
ef29cd70 47 use Class::C3;
d401eda1 48 use base 'LifeForm';
49
50 package Intelligent;
ef29cd70 51 use Class::C3;
d401eda1 52 use base 'Sentient';
53
54 package Humanoid;
ef29cd70 55 use Class::C3;
d401eda1 56 use base 'BiPedal';
57
58 package Vulcan;
ef29cd70 59 use Class::C3;
d401eda1 60 use base ('Intelligent', 'Humanoid');
61}
62
2ffffc6d 63Class::C3::initialize();
64
d401eda1 65is_deeply(
ef29cd70 66 [ Class::C3::calculateMRO('Vulcan') ],
d401eda1 67 [ qw(Vulcan Intelligent Sentient Humanoid BiPedal LifeForm Object) ],
ef29cd70 68 '... got the right MRO for the Vulcan Dylan Example');