File: object.t

package info (click to toggle)
libnumber-format-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: perl: 590; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (4)
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
# -*- CPerl -*-

use Test::More qw(no_plan);
use strict;
use warnings;

use POSIX;
setlocale(&LC_ALL, 'C');

BEGIN { use_ok('Number::Format') }

my $deutsch = Number::Format->new(-thousands_sep   => '.',
                                  -decimal_point   => ',');

isa_ok($deutsch, 'Number::Format', 'object');

is($deutsch->format_number(1234567.509, 2),     '1.234.567,51', 'round');
is($deutsch->format_number(12345678.5, 2),      '12.345.678,5', 'tousends');
is($deutsch->format_number(1.23456789, 6),      '1,234568',     'big frac');

my $double_char = Number::Format->new(
    -thousands_sep => ' ',
    -decimal_point => ',',
);

is(
    $double_char->format_number(12345678.5),
    "12 345 678,5",
    'multi-char thousands separator'
);