1 # -*-Perl-*- Test Harness script for Bioperl
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(
21 -source => 'internal',
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');
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');
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
53 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
54 -start=>50, -end=>61, -strand=>1
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');