TestAlgorithm.php 898 B

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