Annotation of embedaddon/php/ext/standard/tests/strings/convert_uuencode_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test convert_uuencode() function : usage variations - test values for $data argument
3: --FILE--
4: <?php
5:
6: /* Prototype : string convert_uuencode ( string $data )
7: * Description: Uuencode a string
8: * Source code: ext/standard/uuencode.c
9: */
10:
11: echo "*** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***\n";
12:
13: //get an unset variable
14: $unset_var = 'string_val';
15: unset($unset_var);
16:
17: //defining a class
18: class sample {
19: public function __toString() {
20: return "sample object";
21: }
22: }
23:
24: //getting the resource
25: $file_handle = fopen(__FILE__, "r");
26:
27: // array with different values for $data
28: $inputs = array (
29:
30: // integer values
31: /*1*/ 0,
32: 1,
33: 255,
34: 256,
35: 2147483647,
36: -2147483648,
37:
38: // float values
39: /*7*/ 10.5,
40: -20.5,
41: 10.1234567e10,
42:
43: // array values
44: /*10*/ array(),
45: array(0),
46: array(1, 2),
47:
48: // boolean values
49: /*13*/ true,
50: false,
51: TRUE,
52: FALSE,
53:
54: // null values
55: /*17*/ NULL,
56: null,
57:
58: // objects
59: /*19*/ new sample(),
60:
61: // resource
62: /*20*/ $file_handle,
63:
64: // undefined variable
65: /*21*/ @$undefined_var,
66:
67: // unset variable
68: /*22*/ @$unset_var
69: );
70:
71: // loop through with each element of the $data array to test convert_uuencode() function
72: $count = 1;
73: foreach($inputs as $input) {
74: echo "-- Iteration $count --\n";
75: var_dump( bin2hex(convert_uuencode($input)) );
76: $count ++;
77: }
78:
79: fclose($file_handle); //closing the file handle
80:
81: ?>
82: ===DONE===
83: --EXPECTF--
84: *** Testing convert_uuencode() function: with unexpected inputs for 'data' argument ***
85: -- Iteration 1 --
86: string(16) "212c6060600a600a"
87: -- Iteration 2 --
88: string(16) "212c3060600a600a"
89: -- Iteration 3 --
90: string(16) "232c4334550a600a"
91: -- Iteration 4 --
92: string(16) "232c4334560a600a"
93: -- Iteration 5 --
94: string(40) "2a2c4324542d5330582c5338542d5060600a600a"
95: -- Iteration 6 --
96: string(40) "2b2b3328512d233c542e232c562d2340600a600a"
97: -- Iteration 7 --
98: string(24) "242c33604e2d3060600a600a"
99: -- Iteration 8 --
100: string(24) "252b3328502b4334600a600a"
101: -- Iteration 9 --
102: string(40) "2c2c3360512c432c542d3338572c2360500a600a"
103: -- Iteration 10 --
104:
105: Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
106: string(0) ""
107: -- Iteration 11 --
108:
109: Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
110: string(0) ""
111: -- Iteration 12 --
112:
113: Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
114: string(0) ""
115: -- Iteration 13 --
116: string(16) "212c3060600a600a"
117: -- Iteration 14 --
118: string(0) ""
119: -- Iteration 15 --
120: string(16) "212c3060600a600a"
121: -- Iteration 16 --
122: string(0) ""
123: -- Iteration 17 --
124: string(0) ""
125: -- Iteration 18 --
126: string(0) ""
127: -- Iteration 19 --
128: string(48) "2d3c56254d3c26514528265d423a4635433d6060600a600a"
129: -- Iteration 20 --
130:
131: Warning: convert_uuencode() expects parameter 1 to be string, resource given in %s on line %d
132: string(0) ""
133: -- Iteration 21 --
134: string(0) ""
135: -- Iteration 22 --
136: string(0) ""
137: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>