### ----------------------------------------------------
### -- AlgorithmsIT
### -- Licenses: Artistic-2.0
### -- Authors: Tom Browder
### -- File: t/03-class-A1B.t
### ----------------------------------------------------
use Test;

use AlgorithmsIT :ALL; 
use AlgorithmsIT::Classes;

my $debug = 0;

my A1B $a;
my $text = 'some text';
my @list = <a b c>;

lives-ok {
    $a = A1B.new;
}, "empty input builds A1B ok";
is $a.elems, 0;

lives-ok {
    $a = A1B.new: $text;
}, "text input builds ok";
is $a[1], 's';
is $a.length, $text.chars;
is $a.elems, $text.chars;

lives-ok {
    $a = A1B.new: 2, 5;
}, "range input builds ok";
is $a[1], 2;
is $a[4], 5;
is $a.length, 4;
is $a.elems, 4;

lives-ok {
    $a = A1B.new: 5;
}, "range input with end only builds ok";
is $a[1], 1;
is $a[4], 4;
is $a[5], 5;
is $a.length, 5;
is $a.elems, 5;

lives-ok {
    $a = A1B.new: @list;
}, "list input builds ok";
is $a[1], 'a';
is $a.length, 3;
is $a.elems, 3;

done-testing;


