File: 35_perc.t

package info (click to toggle)
libspreadsheet-read-perl 0.93-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,180 kB
  • sloc: perl: 7,309; xml: 751; lisp: 293; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl

use strict;
use warnings;

my     $tests = 77;
use     Test::More;
require Test::NoWarnings;

use     Spreadsheet::Read;
Spreadsheet::Read::parses ("xls") or
    plan skip_all => "No M\$-Excel parser found";

my $xls;
ok ($xls = ReadData ("files/perc.xls", attr => 1), "Excel Percentage testcase");

my $ss   = $xls->[1];
my $attr = $ss->{attr};

foreach my $row (1 .. 19) {
    is ($ss->{attr}[1][$row]{type}, "numeric",		"Type A$row numeric");
    is ($ss->{attr}[2][$row]{type}, "percentage",	"Type B$row percentage");
    is ($ss->{attr}[3][$row]{type}, "percentage",	"Type C$row percentage");

    my $i = int $ss->{"A$row"};
    is ($ss->{"B$row"}, "$i%",		"Formatted values for row $row\n");
    }

unless ($ENV{AUTOMATED_TESTING}) {
    Test::NoWarnings::had_no_warnings ();
    $tests++;
    }
done_testing ($tests);