1#########################
2
3# change 'tests => 1' to 'tests => last_test_to_print';
4use strict;
5use warnings;
6use Test::More tests => 15;
7use lib qw(../lib lib);
8use Data::Range::Compare qw(:HELPER HELPER_CB);
9
10#########################
11
12# Insert your test code below, the Test::More module is use()ed here so read
13# its man page ( perldoc Test::More ) for help writing this test script.
14my %helper=HELPER_CB;
15ok(cmp_values(0,0)==0,'comparing 0 to 0 should return 0');
16ok(cmp_values(1,0)==1,'comparing 1 to 0 should return 1');
17ok(cmp_values(0,1)==-1,'comparing 0 to 1 should return -1');
18
19ok(add_one(1)==2,'adding 1 to 1 should return 2');
20ok(sub_one(3)==2,'subtracting 1 from 3 should return 2');
21
22# a is contiugous with b and b is contiguous with c
23my $cmp_a=Data::Range::Compare->new(\%helper,0,1);
24my $cmp_b=Data::Range::Compare->new(\%helper,2,3);
25my $cmp_c=Data::Range::Compare->new(\%helper,3,4);
26
27ok($cmp_a->cmp_range_start($cmp_a)==0
28  ,'$cmp_a->range_start == $cmp_a->range_start'
29);
30ok($cmp_a->cmp_range_start($cmp_b)!=0
31  ,'$cmp_a->range_start != $cmp_b->range_start'
32);
33ok($cmp_a->cmp_range_start($cmp_b)==-1
34  ,'$cmp_a->range_start < $cmp_b->range_start'
35);
36ok($cmp_b->cmp_range_start($cmp_a)==1
37  ,'$cmp_b->range_start > $cmp_a->range_start'
38);
39
40ok($cmp_a->cmp_range_end($cmp_a)==0
41  ,'$cmp_a->range_start == $cmp_a->range_start'
42);
43ok($cmp_a->cmp_range_end($cmp_b)!=0
44  ,'$cmp_a->range_start != $cmp_b->range_start'
45);
46ok($cmp_a->cmp_range_end($cmp_b)==-1
47  ,'$cmp_a->range_start < $cmp_b->range_start'
48);
49ok($cmp_b->cmp_range_end($cmp_a)==1
50  ,'$cmp_b->range_start > $cmp_a->range_start'
51);
52
53ok(!$cmp_a->contiguous_check($cmp_a),'contiguous_check 1');
54ok($cmp_a->contiguous_check($cmp_b),'contiguous_check 2');
55