123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/6/24
- * Time: 上午1:20
- */
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
- use PHPUnit\Framework\TestCase;
- class TestAlgorithm extends TestCase
- {
- public function testSearch()
- {
- $mobiles = array('13911129897','13951129867','13916129867','13918129867','13911179867','13911109867');
- sort($mobiles);
- $ret = algorithm::bsearch('13911109867',$mobiles);
-
- $ret = $mobiles[$ret];
- $x = $mobiles[0];
- }
- public function testEncrypt()
- {
- $x = encrypt('123456','55668899');
- $y = decrypt($x,'55668899');
- }
- public function testEqual()
- {
- $a = '1a';
- $r1 = $a == 1;
- $r2 = 1 == $a;
- $r3 = $a === 1;
- $r4 = 1 === $a;
- $r5 = '0' === 0;
- $t = intval($a);
- }
- public function testInArray()
- {
- $a = '1a';
- $b = [1,2,3,4,5];
- $t = in_array($a,$b);
- }
- public function testArrayKeyExists()
- {
- $a = '1a';
- $b = [1 => 2,3 => 4];
- $t = array_key_exists($a,$b);
- }
- }
|