mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
- Add new test
This commit is contained in:
parent
fbd3e0da40
commit
ed5ce047db
40
ext/standard/tests/strings/sprintf_f.phpt
Executable file
40
ext/standard/tests/strings/sprintf_f.phpt
Executable file
@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
sprintf %f
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(sprintf("%3.2f", 1.2));
|
||||
var_dump(sprintf("%-3.2f", 1.2));
|
||||
var_dump(sprintf("%03.2f", 1.2));
|
||||
var_dump(sprintf("%-03.2f", 1.2));
|
||||
echo "\n";
|
||||
var_dump(sprintf("%5.2f", 3.4));
|
||||
var_dump(sprintf("%-5.2f", 3.4));
|
||||
var_dump(sprintf("%05.2f", 3.4));
|
||||
var_dump(sprintf("%-05.2f", 3.4));
|
||||
echo "\n";
|
||||
var_dump(sprintf("%7.2f", -5.6));
|
||||
var_dump(sprintf("%-7.2f", -5.6));
|
||||
var_dump(sprintf("%07.2f", -5.6));
|
||||
var_dump(sprintf("%-07.2f", -5.6));
|
||||
echo "\n";
|
||||
var_dump(sprintf("%3.4f", 1.2345678e99));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(4) "1.20"
|
||||
string(4) "1.20"
|
||||
string(4) "1.20"
|
||||
string(4) "1.20"
|
||||
|
||||
string(5) " 3.40"
|
||||
string(5) "3.40 "
|
||||
string(5) "03.40"
|
||||
string(5) "3.400"
|
||||
|
||||
string(7) " -5.60"
|
||||
string(7) "-5.60 "
|
||||
string(7) "-005.60"
|
||||
string(7) "-5.6000"
|
||||
|
||||
string(105) "12345678%d00000000000000000000000000000000000000000000000000.0000"
|
Loading…
Reference in New Issue
Block a user