]>
iEval git - algorithm-bit-xs.git/blob - t/Algorithm-BIT-XS.t
914792a9c0780c375a27e3c05be2cabd36b43255
5 use Test
::More tests
=> 24;
6 BEGIN { use_ok
('Algorithm::BIT::XS') };
7 BEGIN { use_ok
('Algorithm::BIT2D::XS') };
9 my $bit = Algorithm
::BIT
::XS
->new(25);
10 ok
!eval{$bit->query(26); 1}, 'query(26) fails';
11 ok
!eval{$bit->update(26, 5); 1}, 'update(26, 5) fails';
25 is
$bit->query(25), 52;
29 is
$bit->query(25), 32;
34 is
$bit->query(15), 0;
35 is
$bit->query(16), 10;
38 my $bit2d = Algorithm
::BIT2D
::XS
->new(10, 5);
39 ok
!eval{$bit2d->query(11, 5); 1}, 'query(11, 5) fails';
40 ok
!eval{$bit2d->query(10, 6); 1}, 'query(10, 6) fails';
41 ok
!eval{$bit2d->update(11, 5, 2); 1}, 'update(11, 5, 2) fails';
42 ok
!eval{$bit2d->update(10, 6, 2); 1}, 'update(10, 6, 2) fails';
43 is
$bit2d->query(5, 5), 0;
44 $bit2d->update(4, 4, 2);
45 $bit2d->update(5, 1, 3);
46 is
$bit2d->query(5, 5), 5;
47 is
$bit2d->query(5, 2), 3;
This page took 0.062464 seconds and 5 git commands to generate.