wharmby         Sun Jan 18 21:59:36 2009 UTC

  Modified files:              
    /php-src/ext/standard/tests/strings hebrevc_basic.phpt 
                                        hebrevc_variation1.phpt 
                                        hebrevc_variation2.phpt 
                                        hebrev_basic.phpt 
                                        hebrevc_error.phpt 
                                        hebrev_variation2.phpt 
                                        hebrev_variation1.phpt 
                                        hebrev_error.phpt 
  Log:
  New hebrev() and hebrevc()  tests. Tested on Windows. Linux and Linux 64 bit
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrevc_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrevc_basic.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrevc_basic.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrevc_basic.phpt       Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,47 @@
+--TEST--
+Test hebrevc() function : basic functionality 
+--FILE--
+<?php
+
+/* Prototype  : string hebrevc  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() : basic functionality ***\n";
+
+$hebrew_text = b"The hebrevc function converts logical Hebrew text to visual 
text.\nThis function is similar to hebrev() with the difference that it 
converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking 
words.\n";
+
+var_dump(hebrevc($hebrew_text));
+var_dump(hebrevc($hebrew_text, 15));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() : basic functionality ***
+string(239) ".The hebrevc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrev() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+string(317) "to visual text<br />
+Hebrew text<br />
+logical<br />
+converts<br />
+function<br />
+.The hebrevc<br />
+newlines<br />
+it converts<br />
+difference that<br />
+with the<br />
+to hebrev()<br />
+is similar<br />
+) This function<br />
+<to '<br (<br />
+.'<br />
+breaking words<br />
+tries to avoid<br />
+.The function<br />
+"
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrevc_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrevc_variation1.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrevc_variation1.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrevc_variation1.phpt  Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,138 @@
+--TEST--
+Test hebrevc() function : usage variations - test values for $hebrew_text 
argument
+--FILE--
+<?php
+
+/* Prototype  : string hebrevc  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' 
argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $hebrew_text
+$texts =  array (
+
+                 // integer values
+/*1*/    0,
+                 1,
+                 255,
+                 256,
+             2147483647,
+                 -2147483648,
+               
+                 // float values
+/*7*/    10.5,
+                 -20.5,
+                 10.1234567e5,
+               
+                 // array values
+/*10*/   array(),
+                 array(0),
+                 array(1, 2),
+               
+                 // boolean values
+/*13*/   true,
+                 false,
+                 TRUE,
+                 FALSE,
+               
+                 // null values
+/*17*/   NULL,
+                 null,
+               
+                 // objects
+/*19*/   new sample(),
+               
+                 // resource
+/*20*/   $file_handle,
+               
+                 // undefined variable
+/*21*/   @$undefined_var,
+               
+                 // unset variable
+/*22*/   @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrevc() 
function
+$count = 1;
+
+foreach($texts as $hebrew_text) {
+  echo "-- Iteration $count --\n";
+  var_dump( hebrevc($hebrew_text) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() function: with unexpected inputs for 'hebrew_text' 
argument ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(3) "255"
+-- Iteration 4 --
+string(3) "256"
+-- Iteration 5 --
+string(10) "2147483647"
+-- Iteration 6 --
+string(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(10) "1012345.67"
+-- Iteration 10 --
+
+Warning: hebrevc() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrevc() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrevc() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 13 --
+string(1) "1"
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+string(13) "sample object"
+-- Iteration 20 --
+
+Warning: hebrevc() expects parameter 1 to be binary string, resource given in 
%s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrevc_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrevc_variation2.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrevc_variation2.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrevc_variation2.phpt  Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,430 @@
+--TEST--
+Test hebrevc() function : usage variations - test values for 
$max_chars_per_line argument
+--FILE--
+<?php
+
+/* Prototype  : string hebrevc  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() function: with unexpected inputs for 
'max_chars_per_line' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $max_chars_per_line
+$inputs =  array (
+
+                 // integer values
+/*1*/    0,
+                 1,
+                 255,
+                 256,
+             2147483647,
+                 -2147483648,
+               
+                 // float values
+/*7*/    10.5,
+                 -20.5,
+                 10.1234567e5,
+               
+                 // array values
+/*10*/   array(),
+                 array(0),
+                 array(1, 2),
+               
+                 // boolean values
+/*13*/   true,
+                 false,
+                 TRUE,
+                 FALSE,
+               
+                 // null values
+/*17*/   NULL,
+                 null,
+                 
+                 // string values
+/*19*/   "abc",
+                 'abc',
+                 "3abc",
+                 "0abc",
+                 "0x3",
+               
+                 // objects
+/*24*/   new sample(),
+               
+                 // resource
+/*25*/   $file_handle,
+               
+                 // undefined variable
+/*26*/   @$undefined_var,
+               
+                 // unset variable
+/*27*/   @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrevc() 
function
+$count = 1;
+
+$hebrew_text = b"The hebrevcc function converts logical Hebrew text to visual 
text.\nThis function is similar to hebrevc() with the difference that it 
converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking 
words.\n";
+
+foreach($inputs as $max_chars_per_line) {
+  echo "-- Iteration $count --\n";
+  var_dump( hebrevc($hebrew_text, $max_chars_per_line) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() function: with unexpected inputs for 
'max_chars_per_line' argument ***
+-- Iteration 1 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 2 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 3 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 4 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 5 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 6 --
+string(421) "txet<br />
+lausiv<br />
+ot<br />
+txet<br />
+werbeH<br />
+lacigol<br />
+strevnoc<br />
+noitcnuf<br />
+ccverbeh<br />
+ehT.<br />
+senilwen<br />
+strevnoc<br />
+ti<br />
+taht<br />
+ecnereffid<br />
+eht<br />
+htiw<br />
+)(cverbeh<br />
+ot<br />
+ralimis<br />
+si<br />
+noitcnuf<br />
+sihT<br />
+)<br />
+(<br />
+rb<'<br />
+ot<<br />
+'.<br />
+sdrow<br />
+gnikaerb<br />
+diova<br />
+ot<br />
+seirt<br />
+noitcnuf<br />
+ehT.<br />
+"
+-- Iteration 7 --
+string(373) "text<br />
+to visual<br />
+text<br />
+Hebrew<br />
+logical<br />
+converts<br />
+function<br />
+hebrevcc<br />
+.The<br />
+newlines<br />
+converts<br />
+that it<br />
+difference<br />
+with the<br />
+hebrevc()<br />
+similar to<br />
+is<br />
+function<br />
+) This<br />
+<to '<br (<br />
+.'<br />
+words<br />
+breaking<br />
+to avoid<br />
+tries<br />
+function<br />
+.The<br />
+"
+-- Iteration 8 --
+string(421) "txet<br />
+lausiv<br />
+ot<br />
+txet<br />
+werbeH<br />
+lacigol<br />
+strevnoc<br />
+noitcnuf<br />
+ccverbeh<br />
+ehT.<br />
+senilwen<br />
+strevnoc<br />
+ti<br />
+taht<br />
+ecnereffid<br />
+eht<br />
+htiw<br />
+)(cverbeh<br />
+ot<br />
+ralimis<br />
+si<br />
+noitcnuf<br />
+sihT<br />
+)<br />
+(<br />
+rb<'<br />
+ot<<br />
+'.<br />
+sdrow<br />
+gnikaerb<br />
+diova<br />
+ot<br />
+seirt<br />
+noitcnuf<br />
+ehT.<br />
+"
+-- Iteration 9 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 10 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 14 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 15 --
+string(331) "xttel uaisv<br />
+tot ext<br />
+ewbrHel cagilos rtveonc<br />
+ontincfuc vcreebh<br />
+he.Ts<br />
+neliewn<br />
+tsernvcot i<br />
+atthe ncrefeifd<br />
+het<br />
+thwi) c(evbrheo t<br />
+arilims<br />
+isn ioctunf<br />
+isTh) (<br />
+r <b'<br />
+to<<br />
+.'s<br />
+rdwog inakreb<br />
+idvoa<br />
+tos ietrn ioctunf<br />
+he.T<br />
+"
+-- Iteration 16 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 17 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 18 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 19 --
+
+Warning: hebrevc() expects parameter 2 to be long, Unicode string given in %s 
on line %d
+NULL
+-- Iteration 20 --
+
+Warning: hebrevc() expects parameter 2 to be long, Unicode string given in %s 
on line %d
+NULL
+-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(349) "textual vis<br />
+to<br />
+textrew Heb<br />
+icallog<br />
+ertsconvion unctf<br />
+evcchebrThe .<br />
+inesnewlrts onvec<br />
+it<br />
+thatnce feredif<br />
+the<br />
+withc() brevhe<br />
+to<br />
+ilarsim<br />
+is<br />
+tionfunchis ) T<br />
+(<br />
+'<br<to .'<br />
+<br />
+ordsw<br />
+kingbreaoid av<br />
+to<br />
+riest<br />
+tionfuncThe .<br />
+"
+-- Iteration 22 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 23 --
+string(349) "textual vis<br />
+to<br />
+textrew Heb<br />
+icallog<br />
+ertsconvion unctf<br />
+evcchebrThe .<br />
+inesnewlrts onvec<br />
+it<br />
+thatnce feredif<br />
+the<br />
+withc() brevhe<br />
+to<br />
+ilarsim<br />
+is<br />
+tionfunchis ) T<br />
+(<br />
+'<br<to .'<br />
+<br />
+ordsw<br />
+kingbreaoid av<br />
+to<br />
+riest<br />
+tionfuncThe .<br />
+"
+-- Iteration 24 --
+
+Warning: hebrevc() expects parameter 2 to be long, object given in %s on line 
%d
+NULL
+-- Iteration 25 --
+
+Warning: hebrevc() expects parameter 2 to be long, resource given in %s on 
line %d
+NULL
+-- Iteration 26 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+-- Iteration 27 --
+string(241) ".The hebrevcc function converts logical Hebrew text to visual 
text<br />
+) This function is similar to hebrevc() with the difference that it converts 
newlines<br />
+<to '<br (<br />
+.'<br />
+.The function tries to avoid breaking words<br />
+"
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrev_basic.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrev_basic.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrev_basic.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrev_basic.phpt        Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrev() function : basic functionality 
+--FILE--
+<?php
+
+/* Prototype  : string hebrev  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() : basic functionality ***\n";
+
+$hebrew_text = b"The hebrev function converts logical Hebrew text to visual 
text.\nThe function tries to avoid breaking words.\n";
+
+var_dump(hebrev($hebrew_text));
+var_dump(hebrev($hebrew_text, 15));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() : basic functionality ***
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+string(109) "to visual text
+Hebrew text
+logical
+converts
+hebrev function
+.The
+breaking words
+tries to avoid
+.The function
+"
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrevc_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrevc_error.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrevc_error.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrevc_error.phpt       Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrevc() function : error conditions 
+--FILE--
+<?php
+
+/* Prototype  : string hebrevc  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrevc() : error conditions ***\n";
+
+echo "\n-- Testing hebrevc() function with no arguments --\n";
+var_dump( hebrevc() );
+
+echo "\n-- Testing hebrevc() function with more than expected no. of arguments 
--\n";
+$extra_arg = 10;
+var_dump( hebrevc("Hello World", 5, $extra_arg) );
+
+?> 
+===DONE===
+--EXPECTF--
+*** Testing hebrevc() : error conditions ***
+
+-- Testing hebrevc() function with no arguments --
+
+Warning: hebrevc() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing hebrevc() function with more than expected no. of arguments --
+
+Warning: hebrevc() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+ 
+===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrev_variation2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrev_variation2.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrev_variation2.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrev_variation2.phpt   Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,291 @@
+--TEST--
+Test hebrev() function : usage variations - test values for 
$max_chars_per_line argument
+--FILE--
+<?php
+
+/* Prototype  : string hebrev  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() function: with unexpected inputs for 
'max_chars_per_line' argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $max_chars_per_line
+$inputs =  array (
+
+                 // integer values
+/*1*/    0,
+                 1,
+                 255,
+                 256,
+             2147483647,
+                 -2147483648,
+               
+                 // float values
+/*7*/    10.5,
+                 -20.5,
+                 10.1234567e5,
+               
+                 // array values
+/*10*/   array(),
+                 array(0),
+                 array(1, 2),
+               
+                 // boolean values
+/*13*/   true,
+                 false,
+                 TRUE,
+                 FALSE,
+               
+                 // null values
+/*17*/   NULL,
+                 null,
+                 
+                 // string values
+/*19*/   "abc",
+                 'abc',
+                 "3abc",
+                 "0abc",
+                 "0x3",
+               
+                 // objects
+/*24*/   new sample(),
+               
+                 // resource
+/*25*/   $file_handle,
+               
+                 // undefined variable
+/*26*/   @$undefined_var,
+               
+                 // unset variable
+/*27*/   @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrev() function
+$count = 1;
+
+$hebrew_text = b"The hebrev function converts logical Hebrew text to visual 
text.\nThe function tries to avoid breaking words.\n";
+
+foreach($inputs as $max_chars_per_line) {
+  echo "-- Iteration $count --\n";
+  var_dump( hebrev($hebrew_text, $max_chars_per_line) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() function: with unexpected inputs for 'max_chars_per_line' 
argument ***
+-- Iteration 1 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 2 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 3 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 4 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 5 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 6 --
+string(109) "txet
+lausiv
+ot
+txet
+werbeH
+lacigol
+strevnoc
+noitcnuf
+verbeh
+ehT.
+sdrow
+gnikaerb
+diova
+ot
+seirt
+noitcnuf
+ehT.
+"
+-- Iteration 7 --
+string(109) "text
+to visual
+text
+Hebrew
+logical
+converts
+function
+hebrev
+.The
+words
+breaking
+to avoid
+tries
+function
+.The
+"
+-- Iteration 8 --
+string(109) "txet
+lausiv
+ot
+txet
+werbeH
+lacigol
+strevnoc
+noitcnuf
+verbeh
+ehT.
+sdrow
+gnikaerb
+diova
+ot
+seirt
+noitcnuf
+ehT.
+"
+-- Iteration 9 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 10 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrev() expects parameter 2 to be long, array given in %s on line %d
+NULL
+-- Iteration 13 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 14 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 15 --
+string(109) "xttel uaisv
+tot ext
+ewbrHel cagilos rtveonc
+ontincfuv reebh
+he.Ts
+rdwog inakreb
+idvoa
+tos ietrn ioctunf
+he.T
+"
+-- Iteration 16 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 17 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 18 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 19 --
+
+Warning: hebrev() expects parameter 2 to be long, Unicode string given in %s 
on line %d
+NULL
+-- Iteration 20 --
+
+Warning: hebrev() expects parameter 2 to be long, Unicode string given in %s 
on line %d
+NULL
+-- Iteration 21 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(109) "textual vis
+to
+textrew Heb
+icallog
+ertsconvion unctf
+brevhe
+.Therds
+wo
+kingbreaoid av
+to
+riest
+tionfuncThe .
+"
+-- Iteration 22 --
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 23 --
+string(109) "textual vis
+to
+textrew Heb
+icallog
+ertsconvion unctf
+brevhe
+.Therds
+wo
+kingbreaoid av
+to
+riest
+tionfuncThe .
+"
+-- Iteration 24 --
+
+Warning: hebrev() expects parameter 2 to be long, object given in %s on line %d
+NULL
+-- Iteration 25 --
+
+Warning: hebrev() expects parameter 2 to be long, resource given in %s on line 
%d
+NULL
+-- Iteration 26 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+-- Iteration 27 --
+string(109) ".The hebrev function converts logical Hebrew text to visual text
+.The function tries to avoid breaking words
+"
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrev_variation1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrev_variation1.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrev_variation1.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrev_variation1.phpt   Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,138 @@
+--TEST--
+Test hebrev() function : usage variations - test values for $hebrew_text 
argument
+--FILE--
+<?php
+
+/* Prototype  : string hebrev  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' 
argument ***\n";
+
+//get an unset variable
+$unset_var = 'string_val';
+unset($unset_var);
+
+//defining a class
+class sample  {
+  public function __toString() {
+    return "sample object";
+  } 
+}
+
+//getting the resource
+$file_handle = fopen(__FILE__, "r");
+
+// array with different values for $hebrew_text
+$texts =  array (
+
+                 // integer values
+/*1*/    0,
+                 1,
+                 255,
+                 256,
+             2147483647,
+                 -2147483648,
+               
+                 // float values
+/*7*/    10.5,
+                 -20.5,
+                 10.1234567e5,
+               
+                 // array values
+/*10*/   array(),
+                 array(0),
+                 array(1, 2),
+               
+                 // boolean values
+/*13*/   true,
+                 false,
+                 TRUE,
+                 FALSE,
+               
+                 // null values
+/*17*/   NULL,
+                 null,
+               
+                 // objects
+/*19*/   new sample(),
+               
+                 // resource
+/*20*/   $file_handle,
+               
+                 // undefined variable
+/*21*/   @$undefined_var,
+               
+                 // unset variable
+/*22*/   @$unset_var
+);
+
+// loop through with each element of the $texts array to test hebrev() function
+$count = 1;
+
+foreach($texts as $hebrew_text) {
+  echo "-- Iteration $count --\n";
+  var_dump( hebrev($hebrew_text) );
+  $count ++;
+}
+
+fclose($file_handle);  //closing the file handle
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing hebrev() function: with unexpected inputs for 'hebrew_text' 
argument ***
+-- Iteration 1 --
+string(1) "0"
+-- Iteration 2 --
+string(1) "1"
+-- Iteration 3 --
+string(3) "255"
+-- Iteration 4 --
+string(3) "256"
+-- Iteration 5 --
+string(10) "2147483647"
+-- Iteration 6 --
+string(11) "-2147483648"
+-- Iteration 7 --
+string(4) "10.5"
+-- Iteration 8 --
+string(5) "-20.5"
+-- Iteration 9 --
+string(10) "1012345.67"
+-- Iteration 10 --
+
+Warning: hebrev() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 11 --
+
+Warning: hebrev() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 12 --
+
+Warning: hebrev() expects parameter 1 to be binary string, array given in %s 
on line %d
+NULL
+-- Iteration 13 --
+string(1) "1"
+-- Iteration 14 --
+bool(false)
+-- Iteration 15 --
+string(1) "1"
+-- Iteration 16 --
+bool(false)
+-- Iteration 17 --
+bool(false)
+-- Iteration 18 --
+bool(false)
+-- Iteration 19 --
+string(13) "sample object"
+-- Iteration 20 --
+
+Warning: hebrev() expects parameter 1 to be binary string, resource given in 
%s on line %d
+NULL
+-- Iteration 21 --
+bool(false)
+-- Iteration 22 --
+bool(false)
+===DONE===
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/hebrev_error.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/strings/hebrev_error.phpt
diff -u /dev/null php-src/ext/standard/tests/strings/hebrev_error.phpt:1.2
--- /dev/null   Sun Jan 18 21:59:36 2009
+++ php-src/ext/standard/tests/strings/hebrev_error.phpt        Sun Jan 18 
21:59:36 2009
@@ -0,0 +1,35 @@
+--TEST--
+Test hebrev() function : error conditions 
+--FILE--
+<?php
+
+/* Prototype  : string hebrev  ( string $hebrew_text  [, int 
$max_chars_per_line  ] )
+ * Description: Convert logical Hebrew text to visual text
+ * Source code: ext/standard/string.c
+*/
+
+echo "*** Testing hebrev() : error conditions ***\n";
+
+echo "\n-- Testing hebrev() function with no arguments --\n";
+var_dump( hebrev() );
+
+echo "\n-- Testing hebrev() function with more than expected no. of arguments 
--\n";
+$extra_arg = 10;
+var_dump( hebrev("Hello World", 5, $extra_arg) );
+
+?> 
+===DONE===
+--EXPECTF--
+*** Testing hebrev() : error conditions ***
+
+-- Testing hebrev() function with no arguments --
+
+Warning: hebrev() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing hebrev() function with more than expected no. of arguments --
+
+Warning: hebrev() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+ 
+===DONE===
\ No newline at end of file

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

Reply via email to