Add 2D binary indexed trees
[algorithm-bit-xs.git] / t / Algorithm-BIT-XS.t
index c6ce19f40cae5e9d012131cc752a85c415a1a0c2..c2ee47a3cee96a3c35df85d77af74a37722d69ae 100644 (file)
@@ -2,8 +2,9 @@
 use strict;
 use warnings;
 
-use Test::More tests => 13;
+use Test::More tests => 17;
 BEGIN { use_ok('Algorithm::BIT::XS') };
+BEGIN { use_ok('Algorithm::BIT2D::XS') };
 
 my $bit = Algorithm::BIT::XS->new(100);
 is $bit->query(5), 0;
@@ -29,3 +30,11 @@ $bit->clear;
 $bit->set(16,10);
 is $bit->query(15), 0;
 is $bit->query(16), 10;
+
+
+my $bit2d = Algorithm::BIT2D::XS->new(100, 50);
+is $bit2d->query(5, 5), 0;
+$bit2d->update(4, 4, 2);
+$bit2d->update(5, 1, 3);
+is $bit2d->query(5, 5), 5;
+is $bit2d->query(5, 2), 3;
This page took 0.009956 seconds and 4 git commands to generate.