This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add _num_to_alpha() to test.pl
[perl5.git] / t / test_pl / _num_to_alpha.t
CommitLineData
f6e25e60
BG
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9is( _num_to_alpha(-1), undef);
10is( _num_to_alpha( 0), 'A');
11is( _num_to_alpha( 1), 'B');
12
13is( _num_to_alpha(26 - 1), 'Z');
14is( _num_to_alpha(26 ), 'AA');
15is( _num_to_alpha(26 + 1), 'AB');
16
17is( _num_to_alpha(26 + 26 - 2), 'AY');
18is( _num_to_alpha(26 + 26 - 1), 'AZ');
19is( _num_to_alpha(26 + 26 ), 'BA');
20is( _num_to_alpha(26 + 26 + 1), 'BB');
21
22is( _num_to_alpha(26 ** 2 - 1), 'YZ');
23is( _num_to_alpha(26 ** 2 ), 'ZA');
24is( _num_to_alpha(26 ** 2 + 1), 'ZB');
25
26is( _num_to_alpha(26 ** 2 + 26 - 1), 'ZZ');
27is( _num_to_alpha(26 ** 2 + 26 ), 'AAA');
28is( _num_to_alpha(26 ** 2 + 26 + 1), 'AAB');
29
30is( _num_to_alpha(26 ** 3 + 26 ** 2 + 26 - 1 ), 'ZZZ');
31is( _num_to_alpha(26 ** 3 + 26 ** 2 + 26 ), 'AAAA');
32is( _num_to_alpha(26 ** 3 + 26 ** 2 + 26 + 1 ), 'AAAB');
33
34done_testing();