1 # -*-Perl-*- Test Harness script for Bioperl
7 use Bio::SeqFeature::Generic;
8 use Bio::Location::Split;
10 test_begin(-tests => 17);
13 my $DEBUG = test_debug();
15 my $orig = Bio::SeqFeature::Generic->new(
20 -source => 'internal',
28 # Verify simple attributes work and are independent of each other
29 ok(my $clone = $orig->clone(), 'clone()');
30 ok($clone->start(140), 'start() clone set');
31 is($clone->start(), 140, 'start() clone get');
32 is($orig->start(), 40, 'start() original unchanged');
35 # Verify that arguments passed into clone() are applied to the cloned object
36 # and that the attributes are still independent.
37 ok($clone = $orig->clone(-start => 150, -end => 157), 'clone() with arguments');
38 is($orig->start(), 40, 'start() orig get');
39 is($orig->end(), 80, 'end() orig get');
40 is($clone->start(), 150, 'start() clone get');
41 is($clone->end(), 157, 'end() clone get');
42 ok($clone->start(140), 'start() clone set');
43 is($clone->start(), 140, 'start() clone get');
44 is($orig->start(), 40, 'start() original unchanged');
47 # Verify that object attributes can be cloned, and are independent after cloning
48 my $splitlocation = Bio::Location::Split->new();
49 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
50 -start=>1, -end=>30, -strand=>1
52 $splitlocation->add_sub_Location(Bio::Location::Simple->new(
53 -start=>50, -end=>61, -strand=>1
55 ok($orig->location($splitlocation), 'location() Bio::Location::Split');
56 ok($clone = $orig->clone(), 'clone()');
57 ok(($clone->location->sub_Location())[1]->start(51), 'start() clone set');
58 is(($clone->location->sub_Location())[1]->start, 51, 'start() clone get');
59 is(($orig->location->sub_Location())[1]->start, 50, 'start() original unchanged');