File: format.t

package info (click to toggle)
liblocale-currency-format-perl 1.28-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 132 kB
  • ctags: 36
  • sloc: perl: 446; makefile: 2
file content (84 lines) | stat: -rw-r--r-- 2,049 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

BEGIN { $| = 1; print "1..26\n"; }
END   { print "not ok 1\n" unless $loaded; }

use Locale::Currency::Format;

$loaded = 1;

print "ok 1\n";

print "not " unless currency_format('usd', 1000) eq '1,000.00 USD';
print "ok 2\n";

print "not " unless currency_format('usd', 1000, FMT_NOZEROS) eq '1,000 USD';
print "ok 3\n";

print "not " unless currency_format('usd', 1000, FMT_HTML) eq '$1,000.00';
print "ok 4\n";

print "not " unless currency_format('usd', 1000, FMT_NAME) eq "1,000.00 US Dollar";
print "ok 5\n";

print "not " unless currency_format('usd', 1000, FMT_SYMBOL) eq "\x{0024}1,000.00";
print "ok 6\n";

print "not " if currency_format('usd');
print "ok 7\n";

print "not " if currency_format();
print "ok 8\n";

print "not " if currency_format('us', 1000);
print "ok 9\n";

print "not " unless currency_symbol('vnd', SYM_UTF)  eq "\x{20AB}";
print "ok 10\n";

print "not " unless currency_symbol('vnd', SYM_HTML) eq "₫";
print "ok 11\n";

print "not " if currency_symbol();
print "ok 12\n";

print "not " if currency_symbol('usd', 10);
print "ok 13\n";

print "not " if currency_symbol('vn');
print "ok 14\n";

print "not " if currency_symbol('aed');
print "ok 15\n";

print "not " unless currency_set('USD', '#.###,## $', FMT_COMMON);
print "ok 16\n";

print "not " unless currency_format('USD', 1000, FMT_COMMON) eq '1.000,00 $';
print "ok 17\n";

print "not " unless currency_set('USD');
print "ok 18\n";

print "not " unless currency_format('USD', 1000, FMT_COMMON) eq '$1,000.00';
print "ok 19\n";

print "not " unless currency_set('GBP', "\x{00A3}#,###.##", FMT_COMMON);
print "ok 20\n";

print 'not ' unless decimal_precision('usd') == 2;
print "ok 21\n";

print 'not ' unless decimal_precision('bhd') == 3;
print "ok 22\n";

print 'not ' unless decimal_separator('usd') eq '.';
print "ok 23\n";

print 'not ' unless decimal_separator('eur') eq ',';
print "ok 24\n";

print 'not ' unless thousands_separator('usd') eq ',';
print "ok 25\n";

print 'not ' unless thousands_separator('eur') eq '.';
print "ok 26\n";