home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / .tmpsqlite_017.phpt < prev    next >
Encoding:
Text File  |  2004-03-24  |  750 b   |  34 lines

  1. --TEST--
  2. sqlite: UDF binary handling functions
  3. --SKIPIF--
  4. <?php # vim:ft=php
  5. if (!extension_loaded("sqlite")) print "skip"; ?>
  6. --FILE--
  7. <?php 
  8.  
  9. $data = array(
  10.     "hello there",
  11.     "this has a \x00 char in the middle",
  12.     "\x01 this has an 0x01 at the start",
  13.     "this has \x01 in the middle"
  14.     );
  15.  
  16. foreach ($data as $item) {
  17.     $coded = sqlite_udf_encode_binary($item);
  18.     echo bin2hex($coded) . "\n";
  19.     $decoded = sqlite_udf_decode_binary($coded);
  20.     if ($item != $decoded) {
  21.         echo "FAIL! $item decoded is $decoded\n";
  22.     }
  23. }
  24.  
  25. echo "OK!\n";
  26.  
  27. ?>
  28. --EXPECT--
  29. 68656c6c6f207468657265
  30. 0101736768721f6760721f601fff1f626760711f686d1f7367641f6c6863636b64
  31. 0102ff1e726667711e665f711e5f6c1e2e762e2f1e5f721e7266631e71725f7072
  32. 7468697320686173200120696e20746865206d6964646c65
  33. OK!
  34.