From 517865fb6e28e74675a038cac2d1dca338c4c5fd Mon Sep 17 00:00:00 2001 From: Zoe Slattery Date: Wed, 28 Mar 2007 09:38:30 +0000 Subject: [PATCH] New tests for printf and ucfirst --- ext/standard/tests/strings/printf.phpt | 689 ++++++++++++++++++++++++ ext/standard/tests/strings/ucfirst.phpt | Bin 0 -> 6034 bytes 2 files changed, 689 insertions(+) create mode 100755 ext/standard/tests/strings/printf.phpt create mode 100644 ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt new file mode 100755 index 0000000000..a885fc32bb --- /dev/null +++ b/ext/standard/tests/strings/printf.phpt @@ -0,0 +1,689 @@ +--TEST-- +Test printf() function +--FILE-- + +--EXPECTF-- +*** Output for zero argument *** + +Warning: Wrong parameter count for printf() in %s on line %d + +*** Output for insufficient number of arguments *** + +Warning: printf(): Too few arguments in %s on line %d + +*** Output for scalar argument *** +3 +*** Output for NULL as argument *** + + +*** Output for float type *** + + Input Float numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 0.32 + [4] => -0.32 + [5] => 3.4-3.4 + [6] => 2.54 + [7] => -2.54 + [8] => 1.2345678E+99 + [9] => -1.2345678E+99 +) + + +Float Iteration 1 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567%d.000000 +-1234567%d.000000 + +Float Iteration 2 +0.000000 +1.000000 +-1.000000 +0.320000 +-0.320000 +3.400000 +2.540000 +-2.540000 +1234567%d.000000 +-1234567%d.000000 + +Float Iteration 3 ++0.000000 ++1.000000 +-1.000000 ++0.320000 +-0.320000 ++3.400000 ++2.540000 +-2.540000 ++1234567%d.000000 +-1234567%d.000000 + +Float Iteration 4 + 0.00 + 1.00 + -1.00 + 0.32 + -0.32 + 3.40 + 2.54 + -2.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 5 +0.00 +1.00 +-1.00 +0.32 +-0.32 +3.40 +2.54 +-2.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 6 +0000.00 +0001.00 +-001.00 +0000.32 +-000.32 +0003.40 +0002.54 +-002.54 +1234567%d.00 +-1234567%d.00 + +Float Iteration 7 +0.00000 +1.00000 +-1.0000 +0.32000 +-0.3200 +3.40000 +2.54000 +-2.5400 +1234567%d.00 +-1234567%d.00 + +Float Iteration 8 +###0.00 +###1.00 +##-1.00 +###0.32 +##-0.32 +###3.40 +###2.54 +##-2.54 +1234567%d.00 +-1234567%d.00 + +*** Output for integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + + +Integer Iteration 1 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 2 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 3 ++0 ++1 +-1 ++2 +-2 ++23333333 +-23333333 ++1234 + +Integer Iteration 4 + 0 + 1 + -1 + 2 + -2 +23333333 +-23333333 + 1234 + +Integer Iteration 5 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 6 +0000000 +0000001 +-000001 +0000002 +-000002 +23333333 +-23333333 +0001234 + +Integer Iteration 7 +0 +1 +-1 +2 +-2 +23333333 +-23333333 +1234 + +Integer Iteration 8 +######0 +######1 +#####-1 +######2 +#####-2 +23333333 +-23333333 +###1234 + +*** Output for binary type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +11111111111111111111111111111111 +10 +11111111111111111111111111111110 +1011001000000100111010101 +11111110100110111111011000101011 +10011010010 + +*** Output for char type *** + + Input Characters variation array is: +Array +( + [0] => a + [1] => a + [2] => 67 + [3] => -67 + [4] => 99 +) + + + +C +½ +c + +*** Output for scientific type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0.000000e+0 +1.000000e+0 +-1.000000e+0 +2.700000e+0 +-2.700000e+0 +2.333333e+7 +-2.333333e+7 +1.234000e+3 + +*** Output for unsigned integer type *** + + Input Integer numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +4294967295 +2 +4294967294 +23333333 +4271633963 +1234 + +*** Output for octal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +37777777777 +2 +37777777776 +131004725 +37646773053 +2322 + +*** Output for hexadecimal type *** + + Input numbers variation array is: +Array +( + [0] => 0 + [1] => 1 + [2] => -1 + [3] => 2.7 + [4] => -2.7 + [5] => 23333333 + [6] => -23333333 + [7] => 1234 +) + +0 +1 +ffffffff +2 +fffffffe +16409d5 +fe9bf62b +4d2 + +*** Output for string type *** + + Input Strings format variation array is: +Array +( + [0] => %5s + [1] => %-5s + [2] => %05s + [3] => %'#5s +) + + Input strings variation array is: +Array +( + [0] => + [1] => abc + [2] => aaa +) + + + abc + aaa + +abc +aaa +00000 +00abc +00aaa +##### +##abc +##aaa + +*** Output for '%g' type *** + + Input format variation array is: +Array +( + [0] => %g + [1] => %.0g + [2] => %+g + [3] => %-g + [4] => %-1.2g + [5] => %+1.2g + [6] => %G + [7] => %.0G + [8] => %+G + [9] => %-G + [10] => %-1.2G + [11] => %+1.2G +) + +123456 +-123456 +1.0e+5 +-1.0e+5 ++123456 +-123456 +123456 +-123456 +120000 +-120000 ++120000 +-120000 +123456 +-123456 +1.0E+5 +-1.0E+5 ++123456 +-123456 +123456 +-123456 +120000 +-120000 ++120000 +-120000 + +*** Output for '%%%.2f' as the format parameter *** +%12345678900.00 + +*** Output for '%%' as the format parameter *** +% + +*** Output for precision value more than maximum *** +12345678900.0000000000000000000000000000000000000000 + +*** Output for invalid width(-15) specifier *** +15s + +*** Output for '%F' as the format parameter *** +12345678900.000000 + +*** Output for '%X' as the format parameter *** +C + +*** Output with no format parameter *** +12345 + +*** Output for multiple format parameters *** +12345 abcdefghjklmnpqrstuvwxyz 12345 + + +*** Output for excess of mixed type arguments *** +abcdefghjklmnpqrstuvwxyz + +*** Output for string format parameter and integer type argument *** +12345 + +*** Output for integer format parameter and string type argument *** +0 diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt new file mode 100644 index 0000000000000000000000000000000000000000..dbcb3ac265d313f9b5265c934d7c00e9ae293334 GIT binary patch literal 6034 zcmeHLSyS6c5Z+hxD;jawW--`6E+89nkjhpO*a~EmTF6p^G{y?D#?gUsQps=MuV*x} z3{v1BRoRE=fn=tS`Fgsi54YP#yN5^Zw&P}AFNl-0*>b6uMP3@H$Z5A<{<*gc>h_ai zf9R|((Q9!bNl=o;L3G|oNXwAd7qReC8B;bK%GeW$q@`8IkzQYsJBN>+i6rnyL_Ym3 z;y`5yDR2rtCL!iHiQFw`9*R#z9E&kMCjD>InVBJcZYq-$XHt%H#a(tNCv{h@5kbpI z{oTF20~#H?*?UoJHcFcfXsP(zla9MQGqbu%`&k%L4bN4_a=nsQnzNn}oYh2e=K1+q zzRJ!*NuM&6NN5k})nbLZcwpFV#cGsAHrc_AjcqpqaXU4iSyETMv^_kt3 zHC)NYMm6>2)4jvpYLcsIHHW!WOVCfHT4m#GI%N3KR$f5kB+WTx;)$W8M1IO-9d8aBbq=j15sxmr3bLs(Jd$)SQ*xh+ z6hXl$s3%epl8j>&Z&D)0eB}pPkZ;}#MUs%Gve2hUrF15-h%RM}v{ghDJZ3K1rL!^l zvL~_-{_D#KRe%f%3KAMZ7qVRtC8-oXt2bhs&QV_)2;@Nmhmg2bfe&UVL}lUBM=6+2 z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