1#! /usr/bin/perl -w
2
3# two kinds of behavior depending on how its called:
4#
5#   1.  If passed a file name, it does the read/write/re-read/compare test.
6#   2.  If not, it does a read test on all *.nex files in the working directory.
7#
8
9use strict;
10
11use lib '../lib';
12use Bio::NEXUS;
13use Data::Dumper;
14
15my $file_1 = shift @ARGV;
16my $file_2 = shift @ARGV;
17if ($file_1 && $file_2) {
18		#print "read $file, write, read again, compare object with original\n";
19    my $nexus_1 = new Bio::NEXUS($file_1, 0);
20    my $nexus_2 = new Bio::NEXUS($file_2, 0);
21	my $treesblock_1 = $nexus_1->get_block('trees');
22	my $treesblock_2 = $nexus_2->get_block('trees');
23	#print Dumper $treesblock_1;
24	#print Dumper $treesblock_2;
25
26	print "new and improved equals: \n";
27    if ($treesblock_1->_equals_test($treesblock_2)) { print "trees are equal\n"; }
28   	else {print "==> ERROR, trees blocks are not the same\n"; }
29
30	print "the original method: \n";
31    if ($treesblock_1->equals($treesblock_2)) { print "trees are equal\n"; }
32	else { print "==> ERROR, trees blocks are not the same\n"; }
33}
34
35exit;
36