當前位置: 首頁>>代碼示例>>PHP>>正文


PHP check::fail方法代碼示例

本文整理匯總了PHP中check::fail方法的典型用法代碼示例。如果您正苦於以下問題:PHP check::fail方法的具體用法?PHP check::fail怎麽用?PHP check::fail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在check的用法示例。


在下文中一共展示了check::fail方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: long_long_equal

function long_long_equal($a, $b, $message)
{
    if (!($a === $b)) {
        if (!((double) $a === $b)) {
            return check::fail($message . ": '{$a}'!=='{$b}'");
        }
    }
    return TRUE;
}
開發者ID:daxiazh,項目名稱:swig,代碼行數:9,代碼來源:primitive_ref_runme.php

示例2: do_foo

<?php

require "tests.php";
require "director_thread.php";
// No new functions
check::functions(array(millisecondsleep, foo_stop, foo_run, foo_do_foo));
// No new classes
check::classes(array(director_thread, Foo));
// now new vars
check::globals(array(foo_val));
class Derived extends Foo
{
    function do_foo()
    {
        $this->val = $this->val - 1;
    }
}
$d = new Derived();
$d->run();
if ($d->val >= 0) {
    check::fail($d->val);
}
$d->stop();
check::done();
開發者ID:hj3938,項目名稱:crossbridge,代碼行數:24,代碼來源:director_thread_runme.php

示例3: virtualMethod

<?php

require "tests.php";
require "director_pass_by_value.php";
$passByVal = null;
class director_pass_by_value_Derived extends DirectorPassByValueAbstractBase
{
    function virtualMethod($b)
    {
        global $passByVal;
        $passByVal = $b;
    }
}
# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
$caller = new Caller();
$caller->call_virtualMethod(new director_pass_by_value_Derived());
$ret = $passByVal->getVal();
if ($ret != 0x12345678) {
    check::fail("Bad return value, got " . dechex($ret));
}
check::done();
開發者ID:mromberg,項目名稱:swig,代碼行數:21,代碼來源:director_pass_by_value_runme.php

示例4: catch

try {
    $bad->call_int();
    check::fail("Exception wasn't propagated from Bad::return_int()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad int", "propagated exception incorrect");
}
try {
    $bad->call_double();
    check::fail("Exception wasn't propagated from Bad::return_double()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad double", "propagated exception incorrect");
}
try {
    $bad->call_const_char_star();
    check::fail("Exception wasn't propagated from Bad::return_const_char_star()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad const_char_star", "propagated exception incorrect");
}
try {
    $bad->call_std_string();
    check::fail("Exception wasn't propagated from Bad::return_std_string()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad std_string", "propagated exception incorrect");
}
try {
    $bad->call_Bar();
    check::fail("Exception wasn't propagated from Bad::return_Bar()");
} catch (Exception $e) {
    check::equal($e->getMessage(), "bad Bar", "propagated exception incorrect");
}
check::done();
開發者ID:daxiazh,項目名稱:swig,代碼行數:31,代碼來源:director_exception_runme.php

示例5: resource

 function resource($a, $b, $message)
 {
     $resource = trim(check::var_dump($a));
     if (!eregi("^resource\\([0-9]+\\) of type \\({$b}\\)", $resource)) {
         return check::fail($message);
     }
     return TRUE;
 }
開發者ID:daxiazh,項目名稱:swig,代碼行數:8,代碼來源:tests.php


注:本文中的check::fail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。