Annotation of embedaddon/php/ext/standard/tests/strings/hebrevc_variation2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test hebrevc() function : usage variations - test values for $max_chars_per_line argument
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype  : string hebrevc  ( string $hebrew_text  [, int $max_chars_per_line  ] )
                      7:  * Description: Convert logical Hebrew text to visual text
                      8:  * Source code: ext/standard/string.c
                      9: */
                     10: 
                     11: echo "*** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' 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 $max_chars_per_line
                     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.1234567e5,
                     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:                  // string values
                     59: /*19*/   "abc",
                     60:                  'abc',
                     61:                  "3abc",
                     62:                  "0abc",
                     63:                  "0x3",
                     64:                
                     65:                  // objects
                     66: /*24*/   new sample(),
                     67:                
                     68:                  // resource
                     69: /*25*/   $file_handle,
                     70:                
                     71:                  // undefined variable
                     72: /*26*/   @$undefined_var,
                     73:                
                     74:                  // unset variable
                     75: /*27*/   @$unset_var
                     76: );
                     77: 
                     78: // loop through with each element of the $texts array to test hebrevc() function
                     79: $count = 1;
                     80: 
                     81: $hebrew_text = "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";
                     82: 
                     83: foreach($inputs as $max_chars_per_line) {
                     84:   echo "-- Iteration $count --\n";
                     85:   var_dump( hebrevc($hebrew_text, $max_chars_per_line) );
                     86:   $count ++;
                     87: }
                     88: 
                     89: fclose($file_handle);  //closing the file handle
                     90: 
                     91: ?>
                     92: ===DONE===
                     93: --EXPECTF--
                     94: *** Testing hebrevc() function: with unexpected inputs for 'max_chars_per_line' argument ***
                     95: -- Iteration 1 --
                     96: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                     97: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                     98: <to '<br (<br />
                     99: .'<br />
                    100: .The function tries to avoid breaking words<br />
                    101: "
                    102: -- Iteration 2 --
                    103: string(331) "xttel uaisv<br />
                    104: tot ext<br />
                    105: ewbrHel cagilos rtveonc<br />
                    106: ontincfuc vcreebh<br />
                    107: he.Ts<br />
                    108: neliewn<br />
                    109: tsernvcot i<br />
                    110: atthe ncrefeifd<br />
                    111: het<br />
                    112: thwi) c(evbrheo t<br />
                    113: arilims<br />
                    114: isn ioctunf<br />
                    115: isTh) (<br />
                    116: r <b'<br />
                    117: to<<br />
                    118: .'s<br />
                    119: rdwog inakreb<br />
                    120: idvoa<br />
                    121: tos ietrn ioctunf<br />
                    122: he.T<br />
                    123: "
                    124: -- Iteration 3 --
                    125: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    126: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    127: <to '<br (<br />
                    128: .'<br />
                    129: .The function tries to avoid breaking words<br />
                    130: "
                    131: -- Iteration 4 --
                    132: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    133: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    134: <to '<br (<br />
                    135: .'<br />
                    136: .The function tries to avoid breaking words<br />
                    137: "
                    138: -- Iteration 5 --
                    139: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    140: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    141: <to '<br (<br />
                    142: .'<br />
                    143: .The function tries to avoid breaking words<br />
                    144: "
                    145: -- Iteration 6 --
                    146: string(421) "txet<br />
                    147: lausiv<br />
                    148: ot<br />
                    149: txet<br />
                    150: werbeH<br />
                    151: lacigol<br />
                    152: strevnoc<br />
                    153: noitcnuf<br />
                    154: ccverbeh<br />
                    155: ehT.<br />
                    156: senilwen<br />
                    157: strevnoc<br />
                    158: ti<br />
                    159: taht<br />
                    160: ecnereffid<br />
                    161: eht<br />
                    162: htiw<br />
                    163: )(cverbeh<br />
                    164: ot<br />
                    165: ralimis<br />
                    166: si<br />
                    167: noitcnuf<br />
                    168: sihT<br />
                    169: )<br />
                    170: (<br />
                    171: rb<'<br />
                    172: ot<<br />
                    173: '.<br />
                    174: sdrow<br />
                    175: gnikaerb<br />
                    176: diova<br />
                    177: ot<br />
                    178: seirt<br />
                    179: noitcnuf<br />
                    180: ehT.<br />
                    181: "
                    182: -- Iteration 7 --
                    183: string(373) "text<br />
                    184: to visual<br />
                    185: text<br />
                    186: Hebrew<br />
                    187: logical<br />
                    188: converts<br />
                    189: function<br />
                    190: hebrevcc<br />
                    191: .The<br />
                    192: newlines<br />
                    193: converts<br />
                    194: that it<br />
                    195: difference<br />
                    196: with the<br />
                    197: hebrevc()<br />
                    198: similar to<br />
                    199: is<br />
                    200: function<br />
                    201: ) This<br />
                    202: <to '<br (<br />
                    203: .'<br />
                    204: words<br />
                    205: breaking<br />
                    206: to avoid<br />
                    207: tries<br />
                    208: function<br />
                    209: .The<br />
                    210: "
                    211: -- Iteration 8 --
                    212: string(421) "txet<br />
                    213: lausiv<br />
                    214: ot<br />
                    215: txet<br />
                    216: werbeH<br />
                    217: lacigol<br />
                    218: strevnoc<br />
                    219: noitcnuf<br />
                    220: ccverbeh<br />
                    221: ehT.<br />
                    222: senilwen<br />
                    223: strevnoc<br />
                    224: ti<br />
                    225: taht<br />
                    226: ecnereffid<br />
                    227: eht<br />
                    228: htiw<br />
                    229: )(cverbeh<br />
                    230: ot<br />
                    231: ralimis<br />
                    232: si<br />
                    233: noitcnuf<br />
                    234: sihT<br />
                    235: )<br />
                    236: (<br />
                    237: rb<'<br />
                    238: ot<<br />
                    239: '.<br />
                    240: sdrow<br />
                    241: gnikaerb<br />
                    242: diova<br />
                    243: ot<br />
                    244: seirt<br />
                    245: noitcnuf<br />
                    246: ehT.<br />
                    247: "
                    248: -- Iteration 9 --
                    249: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    250: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    251: <to '<br (<br />
                    252: .'<br />
                    253: .The function tries to avoid breaking words<br />
                    254: "
                    255: -- Iteration 10 --
                    256: 
                    257: Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
                    258: NULL
                    259: -- Iteration 11 --
                    260: 
                    261: Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
                    262: NULL
                    263: -- Iteration 12 --
                    264: 
                    265: Warning: hebrevc() expects parameter 2 to be long, array given in %s on line %d
                    266: NULL
                    267: -- Iteration 13 --
                    268: string(331) "xttel uaisv<br />
                    269: tot ext<br />
                    270: ewbrHel cagilos rtveonc<br />
                    271: ontincfuc vcreebh<br />
                    272: he.Ts<br />
                    273: neliewn<br />
                    274: tsernvcot i<br />
                    275: atthe ncrefeifd<br />
                    276: het<br />
                    277: thwi) c(evbrheo t<br />
                    278: arilims<br />
                    279: isn ioctunf<br />
                    280: isTh) (<br />
                    281: r <b'<br />
                    282: to<<br />
                    283: .'s<br />
                    284: rdwog inakreb<br />
                    285: idvoa<br />
                    286: tos ietrn ioctunf<br />
                    287: he.T<br />
                    288: "
                    289: -- Iteration 14 --
                    290: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    291: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    292: <to '<br (<br />
                    293: .'<br />
                    294: .The function tries to avoid breaking words<br />
                    295: "
                    296: -- Iteration 15 --
                    297: string(331) "xttel uaisv<br />
                    298: tot ext<br />
                    299: ewbrHel cagilos rtveonc<br />
                    300: ontincfuc vcreebh<br />
                    301: he.Ts<br />
                    302: neliewn<br />
                    303: tsernvcot i<br />
                    304: atthe ncrefeifd<br />
                    305: het<br />
                    306: thwi) c(evbrheo t<br />
                    307: arilims<br />
                    308: isn ioctunf<br />
                    309: isTh) (<br />
                    310: r <b'<br />
                    311: to<<br />
                    312: .'s<br />
                    313: rdwog inakreb<br />
                    314: idvoa<br />
                    315: tos ietrn ioctunf<br />
                    316: he.T<br />
                    317: "
                    318: -- Iteration 16 --
                    319: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    320: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    321: <to '<br (<br />
                    322: .'<br />
                    323: .The function tries to avoid breaking words<br />
                    324: "
                    325: -- Iteration 17 --
                    326: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    327: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    328: <to '<br (<br />
                    329: .'<br />
                    330: .The function tries to avoid breaking words<br />
                    331: "
                    332: -- Iteration 18 --
                    333: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    334: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    335: <to '<br (<br />
                    336: .'<br />
                    337: .The function tries to avoid breaking words<br />
                    338: "
                    339: -- Iteration 19 --
                    340: 
                    341: Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
                    342: NULL
                    343: -- Iteration 20 --
                    344: 
                    345: Warning: hebrevc() expects parameter 2 to be long, string given in %s on line %d
                    346: NULL
                    347: -- Iteration 21 --
                    348: 
                    349: Notice: A non well formed numeric value encountered in %s on line %d
                    350: string(349) "textual vis<br />
                    351: to<br />
                    352: textrew Heb<br />
                    353: icallog<br />
                    354: ertsconvion unctf<br />
                    355: evcchebrThe .<br />
                    356: inesnewlrts onvec<br />
                    357: it<br />
                    358: thatnce feredif<br />
                    359: the<br />
                    360: withc() brevhe<br />
                    361: to<br />
                    362: ilarsim<br />
                    363: is<br />
                    364: tionfunchis ) T<br />
                    365: (<br />
                    366: '<br<to .'<br />
                    367: <br />
                    368: ordsw<br />
                    369: kingbreaoid av<br />
                    370: to<br />
                    371: riest<br />
                    372: tionfuncThe .<br />
                    373: "
                    374: -- Iteration 22 --
                    375: 
                    376: Notice: A non well formed numeric value encountered in %s on line %d
                    377: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    378: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    379: <to '<br (<br />
                    380: .'<br />
                    381: .The function tries to avoid breaking words<br />
                    382: "
                    383: -- Iteration 23 --
                    384: string(349) "textual vis<br />
                    385: to<br />
                    386: textrew Heb<br />
                    387: icallog<br />
                    388: ertsconvion unctf<br />
                    389: evcchebrThe .<br />
                    390: inesnewlrts onvec<br />
                    391: it<br />
                    392: thatnce feredif<br />
                    393: the<br />
                    394: withc() brevhe<br />
                    395: to<br />
                    396: ilarsim<br />
                    397: is<br />
                    398: tionfunchis ) T<br />
                    399: (<br />
                    400: '<br<to .'<br />
                    401: <br />
                    402: ordsw<br />
                    403: kingbreaoid av<br />
                    404: to<br />
                    405: riest<br />
                    406: tionfuncThe .<br />
                    407: "
                    408: -- Iteration 24 --
                    409: 
                    410: Warning: hebrevc() expects parameter 2 to be long, object given in %s on line %d
                    411: NULL
                    412: -- Iteration 25 --
                    413: 
                    414: Warning: hebrevc() expects parameter 2 to be long, resource given in %s on line %d
                    415: NULL
                    416: -- Iteration 26 --
                    417: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    418: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    419: <to '<br (<br />
                    420: .'<br />
                    421: .The function tries to avoid breaking words<br />
                    422: "
                    423: -- Iteration 27 --
                    424: string(241) ".The hebrevcc function converts logical Hebrew text to visual text<br />
                    425: ) This function is similar to hebrevc() with the difference that it converts newlines<br />
                    426: <to '<br (<br />
                    427: .'<br />
                    428: .The function tries to avoid breaking words<br />
                    429: "
                    430: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>