Example #1
0
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
if (strpos($argv[0], 'test_create') !== false) {
    error_reporting(0);
    test_create($argv[1]);
}
function test_create($file)
{
    $tests = file($file);
    unset($tests[0]);
    $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/tmp/error-output.txt", "w"));
    $results = array('OKAY' => 0, 'FAIL' => 0);
    $format = array('OKAY' => '', 'FAIL' => '', 'NORM' => '');
    foreach ($tests as $test) {
        if (trim($test) === '') {
            echo "\n";
            continue;
        }
        $test_parts = explode('|', $test);
        $teste = trim($test_parts[1]);
Example #2
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);