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