Annotation of embedaddon/php/ext/intl/tests/formatter_parse.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: numfmt_parse()
3: --SKIPIF--
4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5: --FILE--
6: <?php
7:
8: /*
9: * Number parsing.
10: */
11:
12:
13: function ut_main()
14: {
15: $res_str = '';
16:
17: // Test parsing float number.
18: $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL );
19: $res_str .= ut_nfmt_parse( $fmt, "123E-3" ) . "\n";
20:
21: // Test parsing float number as integer.
22: $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL );
23: $res_str .= ut_nfmt_parse( $fmt, "1.23", NumberFormatter::TYPE_INT32 ) . "\n";
24:
25: // Test specifying non-zero parsing start position.
26: $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL );
27: $pos = 2;
28: $res_str .= ut_nfmt_parse( $fmt, "0.123 here", NumberFormatter::TYPE_DOUBLE, $pos ) . "\n";
29: $res_str .= "$pos\n";
30:
31: return $res_str;
32: }
33:
34: include_once( 'ut_common.inc' );
35: ut_run();
36:
37: ?>
38: --EXPECT--
39: 0.123
40: 1
41: 123
42: 5
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>