File: 28_int2col.t

package info (click to toggle)
libspreadsheet-parseexcel-perl 0.6500-1.1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,852 kB
  • sloc: perl: 9,442; makefile: 12
file content (47 lines) | stat: -rwxr-xr-x 959 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -w

###############################################################################
#
# A test for Spreadsheet::ParseExcel.
#
# Tests for Utility int2col() and col2int() functions..
#
# reverse(''), August 2009, John McNamara, jmcnamara@cpan.org
#

use strict;

use Spreadsheet::ParseExcel::Utility qw( int2col col2int );
use Test::More tests => 3;

##############################################################################
#
# Tests.
#
my $col = 'A';
my @got_col;
my @got_int;
my @expected_col;
my @expected_int;

for my $int ( 0 .. 255 ) {
    $expected_col[$int] = $col;
    $expected_int[$int] = $int;

    $got_col[$int] = int2col($int);
    $got_int[$int] = col2int($col);

    $col++;
}

# General tests for full column range.
is_deeply( \@got_col, \@expected_col );
is_deeply( \@got_int, \@expected_int );

# Test for int2col in list context. RT 48967
my ($got) = int2col(27);
my $expected = 'AB';

is($got, $expected);

__END__