kraghuba                Wed Sep 26 06:11:28 2007 UTC

  Modified files:              
    /php-src/ext/standard/tests/strings crc32_error.phpt 
                                        crc32_basic.phpt 
                                        crc32_variation1.phpt 
                                        crc32_variation2.phpt 
                                        crc32_variation3.phpt 
                                        crc32_variation4.phpt 
  Log:
  New testcases for crc32() function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_error.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_error.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_error.phpt Wed Sep 26 06:11:28 2007
@@ -0,0 +1,61 @@
+--TEST--
+Test crc32() function : error conditions 
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) 
+  die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : error conditions
+*/
+
+echo "*** Testing crc32() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing crc32() function with Zero arguments --\n";
+var_dump( crc32() );
+
+//Test crc32 with one more than the expected number of arguments
+echo "\n-- Testing crc32() function with more than expected no. of arguments 
--\n";
+$str = 'string_val';
+$extra_arg = 10;
+var_dump( crc32($str, $extra_arg) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : error conditions ***
+
+-- Testing crc32() function with Zero arguments --
+
+Warning: crc32() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing crc32() function with more than expected no. of arguments --
+
+Warning: crc32() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
+
+--UEXPECTF--
+*** Testing crc32() : error conditions ***
+
+-- Testing crc32() function with Zero arguments --
+
+Warning: crc32() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing crc32() function with more than expected no. of arguments --
+
+Warning: crc32() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_basic.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_basic.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_basic.phpt Wed Sep 26 06:11:28 2007
@@ -0,0 +1,47 @@
+--TEST--
+Test crc32() function : basic functionality 
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) 
+  die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : basic functionality
+*/
+
+echo "*** Testing crc32() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$str = b'string_val1234';
+
+// Calling crc32() with all possible arguments
+
+// checking for the return type of the function
+var_dump( is_int(crc32($str)) );
+
+// Printing the returned value from the function
+printf("%u\n", crc32($str) );
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : basic functionality ***
+bool(true)
+256895812
+Done
+
+--UEXPECTF--
+*** Testing crc32() : basic functionality ***
+bool(true)
+256895812
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_variation1.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_variation1.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_variation1.phpt    Wed Sep 26 
06:11:28 2007
@@ -0,0 +1,290 @@
+--TEST--
+Test crc32() function : usage variations - unexpected values
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) 
+  die("skip this test is for 32bit platform only");
+?>
+
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with unexpected values for str argument
+*/
+
+echo "*** Testing crc32() : with unexpected values for str argument ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// declaring class
+class sample  {
+  public function __toString() {
+    return "object";
+  }
+}
+
+// creating a file resource
+$file_handle = fopen(__FILE__, 'r');
+
+//array of values to iterate over
+$values = array(
+
+      // int data
+      0,
+      1,
+      12345,
+      -2345,
+
+      // float data
+      10.5,
+      -10.5,
+      10.5e10,
+      10.6E-10,
+      .5,
+
+      // array data
+      array(),
+      array(0),
+      array(1),
+      array(1, 2),
+      array('color' => 'red', 'item' => 'pen'),
+
+      // null data
+      NULL,
+      null,
+
+      // boolean data
+      true,
+      false,
+      TRUE,
+      FALSE,
+
+      // empty data
+      "",
+      '',
+
+      // object data
+      new sample(),
+
+      // undefined data
+      $undefined_var,
+
+      // unset data
+      $unset_var,
+
+      // resource
+      $file_handle
+);
+
+// loop through each element of the array for str
+
+$count = 1;
+foreach($values as $value) {
+      echo "\n-- Iteration $count --\n";
+      var_dump( crc32((binary)$value) );
+};
+
+// closing the resource
+fclose($file_handle);
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration 1 --
+int(-186917087)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(-873121252)
+
+-- Iteration 1 --
+int(1860518047)
+
+-- Iteration 1 --
+int(269248583)
+
+-- Iteration 1 --
+int(-834950157)
+
+-- Iteration 1 --
+int(-638440228)
+
+-- Iteration 1 --
+int(-742287383)
+
+-- Iteration 1 --
+int(-2036403827)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-1465013268)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(716753449)
+Done
+
+--UEXPECTF--
+*** Testing crc32() : with unexpected values for str argument ***
+
+Notice: Undefined variable: undefined_var in %s on line %d
+
+Notice: Undefined variable: unset_var in %s on line %d
+
+-- Iteration 1 --
+int(-186917087)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(-873121252)
+
+-- Iteration 1 --
+int(1860518047)
+
+-- Iteration 1 --
+int(269248583)
+
+-- Iteration 1 --
+int(-834950157)
+
+-- Iteration 1 --
+int(-638440228)
+
+-- Iteration 1 --
+int(-742287383)
+
+-- Iteration 1 --
+int(-2036403827)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+
+Notice: Array to string conversion in %s on line %d
+int(1624097203)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-2082672713)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(-1465013268)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 1 --
+int(716753449)
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_variation2.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_variation2.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_variation2.phpt    Wed Sep 26 
06:11:28 2007
@@ -0,0 +1,225 @@
+--TEST--
+Test crc32() function : usage variations - single quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+  die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+* Testing crc32() : with different strings in single quotes passed to the 
function
+*/
+
+echo "*** Testing crc32() : with different strings in single quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+  b'',
+  b' ',
+  b'hello world',
+  b'HELLO WORLD',
+  b' helloworld ',
+
+  b'(hello world)',
+  b'hello(world)',
+  b'helloworld()',
+  b'hello()(world',
+
+  b'"hello" world',
+  b'hello "world"',
+  b'hello""world',
+
+  b'hello\tworld',
+  b'hellowor\\tld',
+  b'\thello world\t',
+  b'hello\nworld',
+  b'hellowor\\nld',
+  b'\nhello world\n',
+  b'\n\thelloworld',
+  b'hel\tlo\n world',
+
+  b'[EMAIL PROTECTED]&',
+  b'[EMAIL PROTECTED]',
+  b'$hello$world',
+
+  b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+   cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+   eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+   gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+   111111111111111111111122222222222222222222222222222222222222222222
+   333333333333333333333333333333333334444444444444444444444444444444
+   555555555555555555555555555555555555555555556666666666666666666666
+   777777777777777777777777777777777777777777777777777777777777777777
+   /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
+   /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'
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1; 
+foreach($string_array as $str) {
+  echo "\n-- Iteration $count --\n";
+  var_dump( crc32($str) );
+  $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in single quotes ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(135755572)
+
+-- Iteration 11 --
+int(27384015)
+
+-- Iteration 12 --
+int(-497244052)
+
+-- Iteration 13 --
+int(-2065897232)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-856440615)
+
+-- Iteration 16 --
+int(647088397)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-2062229676)
+
+-- Iteration 19 --
+int(1169918910)
+
+-- Iteration 20 --
+int(-618551732)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(-1648442217)
+
+-- Iteration 24 --
+int(1431761713)
+Done
+
+--UEXPECTF--
+*** Testing crc32() : with different strings in single quotes ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(135755572)
+
+-- Iteration 11 --
+int(27384015)
+
+-- Iteration 12 --
+int(-497244052)
+
+-- Iteration 13 --
+int(-2065897232)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-856440615)
+
+-- Iteration 16 --
+int(647088397)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-2062229676)
+
+-- Iteration 19 --
+int(1169918910)
+
+-- Iteration 20 --
+int(-618551732)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(-1648442217)
+
+-- Iteration 24 --
+int(1431761713)
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_variation3.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_variation3.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_variation3.phpt    Wed Sep 26 
06:11:28 2007
@@ -0,0 +1,233 @@
+--TEST--
+Test crc32() function : usage variations - double quoted strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+  die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different strings in double quotes passed to the 
function
+*/
+
+echo "*** Testing crc32() : with different strings in double quotes ***\n";
+
+// defining an array of strings
+$string_array = array(
+  b"",
+  b" ",
+  b"hello world",
+  b"HELLO WORLD",
+  b" helloworld ",
+
+  b"(hello world)",
+  b"hello(world)",
+  b"helloworld()",
+  b"hello()(world",
+
+  b"'hello' world",
+  b"hello 'world'",
+  b"hello''world",
+
+  b"hello\tworld",
+  b"hellowor\\tld",
+  b"\thello world\t",
+  b"hello\nworld",
+  b"hellowor\\nld",
+  b"\nhello world\n",
+  b"\n\thelloworld",
+  b"hel\tlo\n world",
+
+  b"[EMAIL PROTECTED]&",
+  b"[EMAIL PROTECTED]",
+  b"$hello$world",
+
+  b"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+   cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+   eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+   gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+   111111111111111111111122222222222222222222222222222222222222222222
+   333333333333333333333333333333333334444444444444444444444444444444
+   555555555555555555555555555555555555555555556666666666666666666666
+   777777777777777777777777777777777777777777777777777777777777777777
+   /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
+   /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"
+);
+
+// looping to check the behaviour of the function for each string in the array
+
+$count = 1; 
+foreach($string_array as $str) {
+  echo "\n-- Iteration $count --\n";
+  var_dump( crc32($str) );
+  $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different strings in double quotes ***
+
+Notice: Undefined variable: hello in %s on line %d
+
+Notice: Undefined variable: world in %s on line %d
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(1191242624)
+
+-- Iteration 11 --
+int(603128807)
+
+-- Iteration 12 --
+int(-525789576)
+
+-- Iteration 13 --
+int(770262395)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-986324846)
+
+-- Iteration 16 --
+int(-1417857067)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-503915034)
+
+-- Iteration 19 --
+int(-254912432)
+
+-- Iteration 20 --
+int(-1581578467)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(1431761713)
+Done
+
+--UEXPECTF--
+*** Testing crc32() : with different strings in double quotes ***
+
+Notice: Undefined variable: hello in %s on line %d
+
+Notice: Undefined variable: world in %s on line %d
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(-378745019)
+
+-- Iteration 3 --
+int(222957957)
+
+-- Iteration 4 --
+int(-2015000997)
+
+-- Iteration 5 --
+int(1234261835)
+
+-- Iteration 6 --
+int(-1867296214)
+
+-- Iteration 7 --
+int(1048577080)
+
+-- Iteration 8 --
+int(2129739710)
+
+-- Iteration 9 --
+int(-1633247628)
+
+-- Iteration 10 --
+int(1191242624)
+
+-- Iteration 11 --
+int(603128807)
+
+-- Iteration 12 --
+int(-525789576)
+
+-- Iteration 13 --
+int(770262395)
+
+-- Iteration 14 --
+int(243585859)
+
+-- Iteration 15 --
+int(-986324846)
+
+-- Iteration 16 --
+int(-1417857067)
+
+-- Iteration 17 --
+int(523630053)
+
+-- Iteration 18 --
+int(-503915034)
+
+-- Iteration 19 --
+int(-254912432)
+
+-- Iteration 20 --
+int(-1581578467)
+
+-- Iteration 21 --
+int(-1828940657)
+
+-- Iteration 22 --
+int(-1654468652)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(1431761713)
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/crc32_variation4.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/crc32_variation4.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/crc32_variation4.phpt:1.2
--- /dev/null   Wed Sep 26 06:11:28 2007
+++ php-src/ext/standard/tests/strings/crc32_variation4.phpt    Wed Sep 26 
06:11:28 2007
@@ -0,0 +1,145 @@
+--TEST--
+Test crc32() function : usage variations - heredoc strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4)
+  die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype  : string crc32(string $str)
+ * Description: Calculate the crc32 polynomial of a string 
+ * Source code: ext/standard/crc32.c
+ * Alias to functions: none
+*/
+
+/*
+ * Testing crc32() : with different heredoc strings passed to the str argument
+*/
+
+echo "*** Testing crc32() : with different heredoc strings ***\n";
+
+// defining different heredoc strings
+$empty_heredoc = <<<EOT
+EOT;
+
+$heredoc_with_newline = <<<EOT
+\n
+
+EOT;
+
+$heredoc_with_characters = <<<EOT
+first line of heredoc string
+second line of heredoc string
+third line of heredocstring
+EOT;
+
+$heredoc_with_newline_and_tabs = <<<EOT
+hello\tworld\nhello\nworld\n
+EOT;
+
+$heredoc_with_alphanumerics = <<<EOT
+hello123world456
+1234hello\t1234
+EOT;
+
+$heredoc_with_embedded_nulls = <<<EOT
+hello\0world\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_hexa_octal = <<<EOT
+hello\0\100\xaaworld\0hello
+\0hello\0
+EOT;
+
+$heredoc_with_long_string = <<<EOT
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb
+cccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddd
+eeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffff
+gggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhh
+111111111111111111111122222222222222222222222222222222222222222222
+333333333333333333333333333333333334444444444444444444444444444444
+555555555555555555555555555555555555555555556666666666666666666666
+777777777777777777777777777777777777777777777777777777777777777777
+/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
+/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/n
+EOT;
+
+$heredoc_strings = array(
+                   $empty_heredoc,
+                   $heredoc_with_newline,
+                   $heredoc_with_characters,
+                   $heredoc_with_newline_and_tabs,
+                   $heredoc_with_alphanumerics,
+                   $heredoc_with_embedded_nulls,
+                   $heredoc_with_hexa_octal,
+                  $heredoc_with_long_string
+                   );
+
+// loop to test the function with each heredoc string in the array
+
+$count = 1;
+foreach($heredoc_strings as $str) {
+  echo "\n-- Iteration $count --\n";
+  var_dump( crc32((binary)$str) );
+  $count++;
+}
+
+echo "Done";
+?>
+--EXPECTF--
+*** Testing crc32() : with different heredoc strings ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1541608299)
+
+-- Iteration 3 --
+int(1588851550)
+
+-- Iteration 4 --
+int(-1726108239)
+
+-- Iteration 5 --
+int(-1847303891)
+
+-- Iteration 6 --
+int(-1260053120)
+
+-- Iteration 7 --
+int(-1718044186)
+
+-- Iteration 8 --
+int(1646793751)
+Done
+
+--UEXPECTF--
+*** Testing crc32() : with different heredoc strings ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1541608299)
+
+-- Iteration 3 --
+int(1588851550)
+
+-- Iteration 4 --
+int(-1726108239)
+
+-- Iteration 5 --
+int(-1847303891)
+
+-- Iteration 6 --
+int(-1260053120)
+
+-- Iteration 7 --
+int(-1718044186)
+
+-- Iteration 8 --
+int(1646793751)
+Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to