Annotation of embedaddon/php/ext/standard/tests/strings/printf_basic7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test printf() function : basic functionality - unsigned format
3: --SKIPIF--
4: <?php
5: if (PHP_INT_SIZE != 4) {
6: die("skip this test is for 32bit platform only");
7: }
8: ?>
9: --FILE--
10: <?php
11: /* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] )
12: * Description: Produces output according to format .
13: * Source code: ext/standard/formatted_print.c
14: */
15:
16: echo "*** Testing printf() : basic functionality - using unsigned format ***\n";
17:
18:
19: // Initialise all required variables
20: $format = "format";
21: $format1 = "%u";
22: $format2 = "%u %u";
23: $format3 = "%u %u %u";
24: $arg1 = -1111;
25: $arg2 = -1234567;
26: $arg3 = +2345432;
27:
28: echo "\n-- Calling printf() with no arguments --\n";
29: $result = printf($format);
30: echo "\n";
31: var_dump($result);
32:
33: echo "\n-- Calling printf() with one arguments --\n";
34: $result = printf($format1, $arg1);
35: echo "\n";
36: var_dump($result);
37:
38: echo "\n-- Calling printf() with two arguments --\n";
39: $result = printf($format2, $arg1, $arg2);
40: echo "\n";
41: var_dump($result);
42:
43: echo "\n-- Calling printf() with three arguments --\n";
44: $result = printf($format3, $arg1, $arg2, $arg3);
45: echo "\n";
46: var_dump($result);
47:
48: ?>
49: ===DONE===
50: --EXPECTF--
51: *** Testing printf() : basic functionality - using unsigned format ***
52:
53: -- Calling printf() with no arguments --
54: format
55: int(6)
56:
57: -- Calling printf() with one arguments --
58: 4294966185
59: int(10)
60:
61: -- Calling printf() with two arguments --
62: 4294966185 4293732729
63: int(21)
64:
65: -- Calling printf() with three arguments --
66: 4294966185 4293732729 2345432
67: int(29)
68: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>