1use strict;
2use warnings;
3
4use Test::More tests => 2;
5
6use UML::Sequence::SimpleSeq;
7BEGIN { use_ok('UML::Sequence'); }
8
9my $outline     = UML::Sequence::SimpleSeq->grab_outline_text('t/washcar');
10my $methods     = UML::Sequence::SimpleSeq->grab_methods($outline);
11
12my $tree = UML::Sequence
13    ->new($methods, $outline, \&UML::Sequence::SimpleSeq::parse_signature,
14         \&UML::Sequence::SimpleSeq::grab_methods);
15
16my @xml_out = split /\n/, $tree->build_xml_sequence('Washing the Car');
17
18chomp(my @correct_xml = <DATA>);
19
20is_deeply(\@xml_out, \@correct_xml, "xml output");
21
22__DATA__
23<?xml version='1.0' ?>
24<sequence title='Washing the Car'>
25<class_list>
26  <class name='At Home' born='0' extends-to='12'>
27    <activation_list>
28      <activation born='0' extends-to='12' offset='0' />
29    </activation_list>
30  </class>
31  <class name='Garage' born='1' extends-to='12'>
32    <activation_list>
33      <activation born='1' extends-to='1' offset='0' />
34      <activation born='5' extends-to='5' offset='0' />
35      <activation born='6' extends-to='6' offset='0' />
36      <activation born='10' extends-to='10' offset='0' />
37      <activation born='11' extends-to='11' offset='0' />
38      <activation born='12' extends-to='12' offset='0' />
39    </activation_list>
40  </class>
41  <class name='Kitchen' born='2' extends-to='4'>
42    <activation_list>
43      <activation born='2' extends-to='4' offset='0' />
44      <activation born='3' extends-to='3' offset='1' />
45      <activation born='4' extends-to='4' offset='1' />
46    </activation_list>
47  </class>
48  <class name='Driveway' born='7' extends-to='9'>
49    <activation_list>
50      <activation born='7' extends-to='7' offset='0' />
51      <activation born='8' extends-to='8' offset='0' />
52      <activation born='9' extends-to='9' offset='0' />
53    </activation_list>
54  </class>
55</class_list>
56
57<arrow_list>
58  <arrow from='At Home' to='Garage' type='call' label='retrieve bucket'
59         from-offset='0' to-offset='0' />
60  <arrow from='At Home' to='Kitchen' type='call' label='prepare bucket'
61         from-offset='0' to-offset='0' />
62  <arrow from='Kitchen' to='Kitchen' type='call' label='pour soap in bucket'
63         from-offset='0' to-offset='1' />
64  <arrow from='Kitchen' to='Kitchen' type='call' label='fill bucket'
65         from-offset='0' to-offset='1' />
66  <arrow from='At Home' to='Garage' type='call' label='get sponge'
67         from-offset='0' to-offset='0' />
68  <arrow from='At Home' to='Garage' type='call' label='open door'
69         from-offset='0' to-offset='0' />
70  <arrow from='At Home' to='Driveway' type='call' label='apply soapy water'
71         from-offset='0' to-offset='0' />
72  <arrow from='At Home' to='Driveway' type='call' label='rinse'
73         from-offset='0' to-offset='0' />
74  <arrow from='At Home' to='Driveway' type='call' label='empty bucket'
75         from-offset='0' to-offset='0' />
76  <arrow from='At Home' to='Garage' type='call' label='close door'
77         from-offset='0' to-offset='0' />
78  <arrow from='At Home' to='Garage' type='call' label='replace sponge'
79         from-offset='0' to-offset='0' />
80  <arrow from='At Home' to='Garage' type='call' label='replace bucket'
81         from-offset='0' to-offset='0' />
82</arrow_list>
83</sequence>
84