Skip to content

Commit

Permalink
Add test for _encode_base36
Browse files Browse the repository at this point in the history
The issue probably would have been caught earlier had I made a test like
this earlier :/
  • Loading branch information
zakame committed Apr 15, 2018
1 parent 4370ed6 commit 167621e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/01_cuid.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,21 @@ subtest 'package variables' => sub {
};

subtest 'private functions' => sub {
plan tests => 6;
plan tests => 7;

subtest 'local encode_base36' => sub {
plan tests => 3;

my $n = 1234;

note explain '$n = ', $n;
is Data::Cuid::_encode_base36(1234), 'A',
'_encode_base36 of $n is truncated';
is Data::Cuid::_encode_base36( 1234, 2 ), 'YA',
'_encode_base36 of $n with given size';
is Data::Cuid::_encode_base36( 1234, 4 ), '00YA',
'_encode_base36 of $n with extra padding';
};

ok Data::Cuid::_fingerprint, 'got fingerprint';
subtest 'fingerprint size' => sub {
Expand Down

0 comments on commit 167621e

Please sign in to comment.