Ejemplo n.º 1
0
    if (is_null($ret)) {
        echo "range error! \n";
        return -1;
    }
    echo "range count: {$ret->count} \n";
    $item = $ret->root;
    while ($item) {
        echo "range item: {$item->value}  {$item->mask} \n";
        $item = $item->next;
    }
    return 0;
}
function test_count($m, $key)
{
    $ret = $m->count($key, "");
    if (is_null($ret)) {
        echo "range error! \n";
        return -1;
    }
    return 0;
}
$m = new MemLinkClient("127.0.0.1", 11001, 11002, 10);
$key = "haha";
test_create($m, $key);
test_stat($m, $key);
test_insert($m, $key);
test_count($m, $key);
test_range($m, $key);
test_tag($m, $key);
test_delete($m, $key);
test_range($m, $key);
Ejemplo n.º 2
0
    echo "\n";
    $sub_tags = $tag_list->getSubTags();
    if (count($sub_tags) > 0) {
        test_tag_list($sub_tags);
    }
}
// Tag tests
$start_time = microtime(true);
echo "Tag Tests:\n\n";
test_tag('date.week=2002-01-04');
// test date tag
test_tag('date.date=20002-01-04');
// test invalid date tag
test_tag('geo.lat=25');
// test machine tag
test_tag('christmas2001');
// test regular tag
// TagList tests
require_once 'Pinhole/PinholeTagList.php';
echo "\nTagList Tests:\n\n";
$tag_list = new PinholeTagList($connection, 'christmas2001/date.year=2007/daniel/date.month=4');
test_tag_list($tag_list);
$tag_list->replace('date.year=2007', PinholeTagFactory::get('christmas'));
test_tag_list($tag_list);
$tag_list = $tag_list->filter(array('PinholeAbstractMachineTag'));
test_tag_list($tag_list);
$end_time = microtime(true);
echo "\ntotal time: ", ($end_time - $start_time) * 1000, "ms\n";
/*
require_once 'Pinhole/dataobjects/PinholeTagWrapper.php';