Retire SeqHound support.
[bioperl-live.git] / t / SeqFeature / Clone.t
blob9016b7e3a21d6e067599640b9c7b8d393f02a2bb
1 # -*-Perl-*- Test Harness script for Bioperl
3 use strict;
5 BEGIN {
6     use lib '.';
7     use Bio::Root::Test;
8     use Bio::SeqFeature::Generic;
9     use Bio::Location::Split;
11     test_begin(-tests => 17);
14 my $DEBUG = test_debug();
16 my $orig = Bio::SeqFeature::Generic->new(
17                                        -start => 40,
18                                        -end => 80,
19                                        -strand => 1,
20                                        -primary => 'exon',
21                                        -source  => 'internal',
22                                        -tag => {
23                                            silly => 20,
24                                            new => 1
25                                            }
26                                        );
28 # ----------
29 # Verify simple attributes work and are independent of each other
30 ok(my $clone = $orig->clone(),                'clone()');
31 ok($clone->start(140),                        'start() clone set');
32 is($clone->start(),     140,                  'start() clone get');
33 is($orig->start(),      40,                   'start() original unchanged');
35 # ----------
36 # Verify that arguments passed into clone() are applied to the cloned object
37 # and that the attributes are still independent.
38 ok($clone = $orig->clone(-start => 150, -end => 157),   'clone() with arguments');
39 is($orig->start(),       40,                  'start() orig get');
40 is($orig->end(),         80,                  'end() orig get');
41 is($clone->start(),     150,                  'start() clone get');
42 is($clone->end(),       157,                  'end() clone get');
43 ok($clone->start(140),                        'start() clone set');
44 is($clone->start(),     140,                  'start() clone get');
45 is($orig->start(),       40,                  'start() original unchanged');
47 # ----------
48 # Verify that object attributes can be cloned, and are independent after cloning
49 my $splitlocation = Bio::Location::Split->new();
50 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
51    -start=>1, -end=>30, -strand=>1
52 ));
53 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
54    -start=>50, -end=>61, -strand=>1
55 ));
56 ok($orig->location($splitlocation),                      'location() Bio::Location::Split');
57 ok($clone = $orig->clone(),                           'clone()');
58 ok(($clone->location->sub_Location())[1]->start(51),     'start() clone set');
59 is(($clone->location->sub_Location())[1]->start,     51, 'start() clone get');
60 is(($orig->location->sub_Location())[1]->start,      50, 'start() original unchanged');