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