TestAlgorithm.php 764 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/6/24
  6. * Time: 上午1:20
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. require_once(BASE_ROOT_PATH . '/fooder.php');
  10. require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
  11. class TestAlgorithm extends PHPUnit_Framework_TestCase
  12. {
  13. public function testSearch()
  14. {
  15. $mobiles = array('13911129897','13951129867','13916129867','13918129867','13911179867','13911109867');
  16. sort($mobiles);
  17. $ret = algorithm::bsearch('13911109867',$mobiles);
  18. $ret = $mobiles[$ret];
  19. $x = $mobiles[0];
  20. }
  21. public function testEncrypt()
  22. {
  23. $x = encrypt('123456','55668899');
  24. $y = decrypt($x,'55668899');
  25. }
  26. }