1 use Test::More tests => 14;
10 use Support::TestSetup;
12 use_ok 'SL::PrefixedNumber';
15 return SL::PrefixedNumber->new(number => $_[0]);
18 is(n('FB4711' )->get_next, 'FB4712', 'increment FB4711');
19 is(n('4711' )->get_next, '4712', 'increment 4711');
20 is(n('FB54UFB4711')->get_next, 'FB54UFB4712', 'increment FB54UFB4711');
21 is(n('FB' )->get_next, 'FB1', 'increment FB');
22 is(n('' )->get_next, '1', 'increment ""');
23 is(n('0042-FB' )->get_next, '0042-FB1', 'increment 0042-FB');
26 is($o->get_next, '0042-FB2', 'increment 0042-FB twice');
28 is(n('FB4711')->set_to(54), 'FB0054', 'set FB4711 to 54');
31 is($o->get_next, 'FB0055', 'set FB4711 to 54 then increment');
33 is(n('FB121231')->get_current, 'FB121231', 'set FB121231 get current');
34 is(n('FB121231')->format(42), 'FB000042', 'set FB121231 format 42');
35 is(n('FB123123')->set_to_max('FB0711', 'FB911', 'FB8'), 'FB000911', 'set FB123123 max FB000911');
37 throws_ok { n()->get_next } qr/no.*number/i, 'get_next without number set';