1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2016/10/7
- * Time: 下午1:03
- */
- define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_ROOT_PATH . '/helper/search/searcher.php');
- require_once(BASE_ROOT_PATH . '/helper/search/server.php');
- require_once(BASE_ROOT_PATH . '/helper/search/processor.php');
- require_once(BASE_ROOT_PATH . '/helper/search/tcp_client.php');
- require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
- class TestSearch extends PHPUnit_Framework_TestCase
- {
- public static function setUpBeforeClass()
- {
- Base::run_util();
- }
- public function testInit()
- {
- $dict = new search\goods_dict();
- $dict->init();
- }
- public function testSearcher()
- {
- $searcher = new search\searcher();
- $result = $searcher->get_result('眼光影');
- }
- public function testRequest()
- {
- $result = search\tcp_client::instance()->get_result('眼影');
- }
- public function testUasort()
- {
- $words = [];
- $words[] = array("add_time" => 104,"count" => 1);
- $words[] = array("add_time" => 100,"count" => 1);
- $words[] = array("add_time" => 300,"count" => 1);
- $ret = uasort($words,'comp_time');
- foreach ($words as $key => $val) {
- echo $key;
- }
- }
- public function testUnion()
- {
- $a1 = array(1,3,5,7,9);
- $a2 = array(1,2,3,5,8,9);
- $result = algorithm::set_union($a1,$a2);
- }
- }
|