1--TEST--
2Test crc32() function : usage variations - single quoted strings
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4)
6  die("skip this test is for 32bit platform only");
7?>
8--FILE--
9<?php
10/*
11* Testing crc32() : with different strings in single quotes passed to the function
12*/
13
14echo "*** Testing crc32() : with different strings in single quotes ***\n";
15
16// defining an array of strings
17$string_array = array(
18  '',
19  ' ',
20  'hello world',
21  'HELLO WORLD',
22  ' helloworld ',
23
24  '(hello world)',
25  'hello(world)',
26  'helloworld()',
27  'hello()(world',
28
29  '"hello" world',
30  'hello "world"',
31  'hello""world',
32
33  'hello\tworld',
34  'hellowor\\tld',
35  '\thello world\t',
36  'hello\nworld',
37  'hellowor\\nld',
38  '\nhello world\n',
39  '\n\thelloworld',
40  'hel\tlo\n world',
41
42  '!@#$%&',
43  '#hello@world.com',
44  '$hello$world',
45
46  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
47   cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
48   eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
49   gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
50   111111111111111111111122222222222222222222222222222222222222222222
51   333333333333333333333333333333333334444444444444444444444444444444
52   555555555555555555555555555555555555555555556666666666666666666666
53   777777777777777777777777777777777777777777777777777777777777777777
54   /t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t/t
55   /n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n/n'
56);
57
58// looping to check the behaviour of the function for each string in the array
59
60$count = 1;
61foreach($string_array as $str) {
62  echo "\n-- Iteration $count --\n";
63  var_dump( crc32($str) );
64  $count++;
65}
66
67echo "Done";
68?>
69--EXPECT--
70*** Testing crc32() : with different strings in single quotes ***
71
72-- Iteration 1 --
73int(0)
74
75-- Iteration 2 --
76int(-378745019)
77
78-- Iteration 3 --
79int(222957957)
80
81-- Iteration 4 --
82int(-2015000997)
83
84-- Iteration 5 --
85int(1234261835)
86
87-- Iteration 6 --
88int(-1867296214)
89
90-- Iteration 7 --
91int(1048577080)
92
93-- Iteration 8 --
94int(2129739710)
95
96-- Iteration 9 --
97int(-1633247628)
98
99-- Iteration 10 --
100int(135755572)
101
102-- Iteration 11 --
103int(27384015)
104
105-- Iteration 12 --
106int(-497244052)
107
108-- Iteration 13 --
109int(-2065897232)
110
111-- Iteration 14 --
112int(243585859)
113
114-- Iteration 15 --
115int(-856440615)
116
117-- Iteration 16 --
118int(647088397)
119
120-- Iteration 17 --
121int(523630053)
122
123-- Iteration 18 --
124int(-2062229676)
125
126-- Iteration 19 --
127int(1169918910)
128
129-- Iteration 20 --
130int(-618551732)
131
132-- Iteration 21 --
133int(-1828940657)
134
135-- Iteration 22 --
136int(-1654468652)
137
138-- Iteration 23 --
139int(-1648442217)
140
141-- Iteration 24 --
142int(1431761713)
143Done
144