]> iEval git - algorithm-bit-xs.git/blob - t/Algorithm-BIT-XS.t
c6ce19f40cae5e9d012131cc752a85c415a1a0c2
[algorithm-bit-xs.git] / t / Algorithm-BIT-XS.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::More tests => 13;
6 BEGIN { use_ok('Algorithm::BIT::XS') };
7
8 my $bit = Algorithm::BIT::XS->new(100);
9 is $bit->query(5), 0;
10 $bit->update(4, 2);
11 $bit->update(5, 3);
12 is $bit->query(3), 0;
13 is $bit->query(4), 2;
14 is $bit->query(5), 5;
15 is $bit->query(6), 5;
16
17 $bit->update(5, -3);
18 is $bit->query(5), 2;
19
20 $bit->update(17, 50);
21 is $bit->query(25), 52;
22 is $bit->get(25), 0;
23
24 $bit->set(17, 30);
25 is $bit->query(25), 32;
26 is $bit->get(17), 30;
27
28 $bit->clear;
29 $bit->set(16,10);
30 is $bit->query(15), 0;
31 is $bit->query(16), 10;
This page took 0.043215 seconds and 3 git commands to generate.