1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 24);
12 use_ok('Bio::Phenotype::MeSH::Term');
13 use_ok('Bio::Phenotype::MeSH::Twig');
15 # For tests of Bio::DB::MeSH see t/DB.t
17 my $verbose = test_debug();
19 ok my $term = Bio::Phenotype::MeSH::Term->new(-verbose =>$verbose);
20 is $term->id('D000001'), 'D000001';
21 is $term->id, 'D000001';
22 is $term->name('Dietary Fats'), 'Dietary Fats';
23 is $term->name, 'Dietary Fats';
24 is $term->description('dietary fats are...'), 'dietary fats are...';
25 is $term->description, 'dietary fats are...';
27 ok my $twig = Bio::Phenotype::MeSH::Twig->new(-verbose =>$verbose);
28 is $twig->parent('Fats'), 'Fats';
29 is $twig->parent(), 'Fats';
32 ok $term->add_twig($twig);
33 is $term->each_twig(), 1;
34 is $twig->term, $term;
36 is $twig->add_sister('Bread', 'Candy', 'Cereals'), 3;
37 is $twig->add_sister('Condiments', 'Dairy Products'), 2;
38 is $twig->each_sister(), 5;
39 ok $twig->purge_sisters();
40 is $twig->each_sister(), 0;
42 is $twig->add_child('Butter', 'Margarine'), 2;
43 is $twig->each_child(), 2;
44 ok $twig->purge_children();
45 is $twig->each_child(), 0;