本文整理汇总了PHP中check::equal方法的典型用法代码示例。如果您正苦于以下问题:PHP check::equal方法的具体用法?PHP check::equal怎么用?PHP check::equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类check
的用法示例。
在下文中一共展示了check::equal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copy_intp
<?php
require "tests.php";
require "argout.php";
check::functions(array(incp, incr, inctr, new_intp, copy_intp, delete_intp, intp_assign, intp_value, voidhandle, handle));
$ip = copy_intp(42);
check::equal(42, incp($ip), "42==incp({$ip})");
check::equal(43, intp_value($ip), "43={$ip}");
$p = copy_intp(2);
check::equal(2, incp($p), "2==incp({$p})");
check::equal(3, intp_value($p), "3=={$p}");
$r = copy_intp(7);
check::equal(7, incr($r), "7==incr({$r})");
check::equal(8, intp_value($r), "8=={$r}");
$tr = copy_intp(4);
check::equal(4, inctr($tr), "4==incr({$tr})");
check::equal(5, intp_value($tr), "5=={$tr}");
# Check the voidhandle call, first with null
unset($handle);
# FIXME: Call-time pass-by-reference has been deprecated for ages, and was
# removed in PHP 5.4. We need to rework
#voidhandle(&$handle);
#check::resource($handle,"_p_void",'$handle is not _p_void');
#$handledata=handle($handle);
#check::equal($handledata,"Here it is","\$handledata != \"Here it is\"");
unset($handle);
voidhandle($handle);
check::isnull($handle, '$handle not null');
check::done();
示例2: array
<?php
require "tests.php";
require "arrays_global_twodim.php";
check::functions(array(fn_taking_arrays, get_2d_array, new_simplestruct, new_material));
check::classes(array(arrays_global_twodim, SimpleStruct, Material));
check::globals(array(array_c, array_sc, array_uc, array_s, array_us, array_i, array_ui, array_l, array_ul, array_ll, array_f, array_d, array_struct, array_structpointers, array_ipointers, array_enum, array_enumpointers, array_const_i, chitmat, hitmat_val, hitmat, simplestruct_double_field));
$a1 = array(10, 11, 12, 13);
$a2 = array(14, 15, 16, 17);
$a = array($a1, $a2);
$_a = check::get(array_const_i);
for ($x = 0; $x < count($a1); $x++) {
for ($y = 0; $y < 2; $y++) {
check::equal($a[$y][$x], get_2d_array($_a, $y, $x), "check array {$x},{$y}");
}
}
check::done();
示例3: chops
<?php
require "tests.php";
require "enum_scope_template.php";
check::classes(array("enum_scope_template", "TreeInt"));
check::functions("chops");
check::equal(0, TreeInt_Oak, "0==TreeInt_Oak");
check::equal(1, TreeInt_Fir, "1==TreeInt_Fir");
check::equal(2, TreeInt_Cedar, "2==TreeInt_Cedar");
check::equal(TreeInt_Oak, chops(TreeInt_Oak), "TreeInt_Oak==chops(TreeInt_Oak)");
check::equal(TreeInt_Fir, chops(TreeInt_Fir), "TreeInt_Fir==chops(TreeInt_Fir)");
check::equal(TreeInt_Cedar, chops(TreeInt_Cedar), "TreeInt_Cedar==chops(TreeInt_Cedar)");
check::done();
示例4: Struct
<?php
require "tests.php";
require "pointer_reference.php";
$s = pointer_reference::get();
check::equal($s->value, 10, "pointer_reference::get() failed");
$ss = new Struct(20);
pointer_reference::set($ss);
$i = Struct::instance();
check::equal($i->value, 20, "pointer_reference::set() failed");
check::equal(pointer_reference::overloading(1), 111, "overload test 1 failed");
check::equal(pointer_reference::overloading($ss), 222, "overload test 2 failed");
check::done();
示例5: cheer
function cheer()
{
return "FooBar3::cheer();";
}
}
$b = new Bar();
$f = $b->create();
$fb = new FooBar();
$fb2 = new FooBar2();
$fb3 = new FooBar3();
check::equal($fb->used(), "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::used");
check::equal($fb2->used(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad FooBar2::used");
check::equal($b->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Bar::pong");
check::equal($f->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Foo::pong");
check::equal($fb->pong(), "Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::pong");
$method = new ReflectionMethod('Bar', 'ping');
check::equal($method->isProtected(), true, "Foo::ping should be protected");
$method = new ReflectionMethod('Foo', 'ping');
check::equal($method->isProtected(), true, "Foo::ping should be protected");
$method = new ReflectionMethod('FooBar', 'pang');
check::equal($method->isProtected(), true, "FooBar::pang should be protected");
$method = new ReflectionMethod('Bar', 'cheer');
check::equal($method->isProtected(), true, "Bar::cheer should be protected");
$method = new ReflectionMethod('Foo', 'cheer');
check::equal($method->isProtected(), true, "Foo::cheer should be protected");
check::equal($fb3->cheer(), "FooBar3::cheer();", "bad fb3::pong");
check::equal($fb2->callping(), "FooBar2::ping();", "bad fb2::callping");
check::equal($fb2->callcheer(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad fb2::callcheer");
check::equal($fb3->callping(), "Bar::ping();", "bad fb3::callping");
check::equal($fb3->callcheer(), "FooBar3::cheer();", "bad fb3::callcheer");
check::done();
示例6: test1
<?php
require "tests.php";
require "grouping.php";
check::functions(array("test1", "test2", "do_unary", "negate"));
check::equal(5, test1(5), "5==test1(5)");
check::resource(test2(7), "_p_int", "_p_int==test2(7)");
check::globals(array(test3));
//check::equal(37,test3_get(),'37==test3_get()');
check::equal(37, check::get("test3"), '37==get(test3)');
//test3_set(38);
check::set(test3, 38);
//check::equal(38,test3_get(),'38==test3_get() after test3_set(37)');
check::equal(38, check::get(test3), '38==get(test3) after set(test)');
check::equal(-5, negate(5), "-5==negate(5)");
check::equal(7, do_unary(-7, NEGATE), "7=do_unary(-7,NEGATE)");
check::done();
示例7: Global_char_set
require "tests.php";
require "char_strings.php";
$CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible.";
$OTHERLAND_MSG_10 = "Little message from the safe world.10";
check::equal(GetCharHeapString(), $CPLUSPLUS_MSG, "failed GetCharHeapString");
check::equal(GetConstCharProgramCodeString(), $CPLUSPLUS_MSG, "failed GetConstCharProgramCodeString");
check::equal(GetCharStaticString(), $CPLUSPLUS_MSG, "failed GetCharStaticString");
check::equal(GetCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetCharStaticStringFixed");
check::equal(GetConstCharStaticStringFixed(), $CPLUSPLUS_MSG, "failed GetConstCharStaticStringFixed");
check::equal(SetCharHeapString($OTHERLAND_MSG_10, 10), true, "failed GetConstCharStaticStringFixed");
check::equal(SetCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharStaticString");
check::equal(SetCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetCharArrayStaticString");
check::equal(SetConstCharHeapString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharHeapString");
check::equal(SetConstCharStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharStaticString");
check::equal(SetConstCharArrayStaticString($OTHERLAND_MSG_10, 10), true, "failed SetConstCharArrayStaticString");
check::equal(CharPingPong($OTHERLAND_MSG_10), $OTHERLAND_MSG_10, "failed CharPingPong");
Global_char_set($OTHERLAND_MSG_10);
check::equal(Global_char_get(), $OTHERLAND_MSG_10, "failed Global_char_get");
Global_char_array1_set($OTHERLAND_MSG_10);
check::equal(Global_char_array1_get(), $OTHERLAND_MSG_10, "failed Global_char_array1_get");
Global_char_array2_set($OTHERLAND_MSG_10);
check::equal(Global_char_array2_get(), $OTHERLAND_MSG_10, "failed Global_char_array2_get");
check::equal(Global_const_char_get(), $CPLUSPLUS_MSG, "failed Global_const_char");
check::equal(Global_const_char_array1_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array1");
check::equal(Global_const_char_array2_get(), $CPLUSPLUS_MSG, "failed Global_const_char_array2");
check::equal(GetCharPointerRef(), $CPLUSPLUS_MSG, "failed GetCharPointerRef");
check::equal(SetCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetCharPointerRef");
check::equal(GetConstCharPointerRef(), $CPLUSPLUS_MSG, "failed GetConstCharPointerRef");
check::equal(SetConstCharPointerRef($OTHERLAND_MSG_10, 10), true, "failed SetConstCharPointerRef");
check::done();
示例8: foo
<?php
require "tests.php";
require "evil_diamond_prop.php";
check::classes(array("evil_diamond_prop", "foo", "bar", "baz", "spam"));
check::functions("test");
check::is_a("bar", "foo");
check::is_a("baz", "foo");
check::is_a("spam", "foo");
check::is_a("spam", "bar");
//No multiple inheritance introspection yet
//check::is_a("spam","baz");
$foo = new foo();
check::is_a($foo, "foo");
check::equal(1, $foo->_foo, "1==foo->_foo");
$bar = new bar();
check::is_a($bar, "bar");
check::equal(1, $bar->_foo, "1==bar->_foo");
check::equal(2, $bar->_bar, "2==bar->_bar");
$baz = new baz();
check::is_a($baz, "baz");
check::equal(1, $baz->_foo, "1==baz->_foo");
check::equal(3, $baz->_baz, "3==baz->_baz");
$spam = new spam();
check::is_a($spam, "spam");
check::equal(1, $spam->_foo, "1==spam->_foo");
check::equal(2, $spam->_bar, "2==spam->_bar");
// multiple inheritance not supported in PHP
check::equal(null, $spam->_baz, "null==spam->_baz");
check::equal(4, $spam->_spam, "4==spam->_spam");
check::done();
示例9: isnull
function isnull($a, $message)
{
$value = trim(check::var_dump($a));
return check::equal($value, "NULL", $message);
}
示例10: PhpFoo
{
return "PhpFoo::ping()";
}
}
$a = new PhpFoo();
check::equal($a->ping(), "PhpFoo::ping()", "ping failed");
check::equal($a->pong(), "Foo::pong();PhpFoo::ping()", "pong failed");
$b = new Foo();
check::equal($b->ping(), "Foo::ping()", "ping failed");
check::equal($b->pong(), "Foo::pong();Foo::ping()", "pong failed");
$a = new A1(1);
check::equal($a->rg(2), 2, "rg failed");
class PhpClass extends MyClass
{
function vmethod($b)
{
$b->x = $b->x + 31;
return $b;
}
}
$b = new Bar(3);
$d = new MyClass();
$c = new PhpClass();
$cc = MyClass::get_self($c);
$dd = MyClass::get_self($d);
$bc = $cc->cmethod($b);
$bd = $dd->cmethod($b);
$cc->method($b);
check::equal($bc->x, 34, "bc failed");
check::equal($bd->x, 16, "bd failed");
check::done();
示例11: B
}
$b = new B();
check::equal($b->step(), "Bar::step;Foo::advance;B::do_advance;B::do_step;", "Bad B virtual resolution");
class C extends FooBar_int
{
function do_advance()
{
return "C::do_advance;" . parent::do_advance();
}
function do_step()
{
return "C::do_step;";
}
function get_value()
{
return 2;
}
function get_name()
{
return parent::get_name() . " hello";
}
}
$cc = new C();
# TODO: Currently we do not track the dynamic type of returned
# objects, so we skip the get_self() call.
#$c = Foobar_int::get_self($cc);
$c = $cc;
$c->advance();
check::equal($c->get_name(), "FooBar::get_name hello", "get_name failed");
check::equal($c->name(), "FooBar::get_name hello", "name failed");
check::done();
示例12: ping
{
return "FooBar::ping();";
}
}
class FooBar2 extends Bar
{
function ping()
{
return "FooBar2::ping();";
}
function pang()
{
return "FooBar2::pang();";
}
}
$b = new Bar();
$f = $b->create();
$fb = new FooBar();
$fb2 = new FooBar2();
check::equal($fb->used(), "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::used");
check::equal($fb2->used(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad FooBar2::used");
check::equal($b->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Bar::pong");
check::equal($f->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Foo::pong");
check::equal($fb->pong(), "Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::pong");
$method = new ReflectionMethod('Bar', 'ping');
check::equal($method->isProtected(), true, "Boo::ping should be protected");
$method = new ReflectionMethod('Foo', 'ping');
check::equal($method->isProtected(), true, "Foo::ping should be protected");
$method = new ReflectionMethod('FooBar', 'pang');
check::equal($method->isProtected(), true, "FooBar::pang should be protected");
check::done();
示例13: Struct
<?php
require "tests.php";
require "pointer_reference.php";
$s = pointer_reference::get();
check::equal($s->value, 10, "pointer_reference::get() failed");
$ss = new Struct(20);
pointer_reference::set($ss);
$i = Struct::instance();
check::equal($i->value, 20, "pointer_reference::set() failed");
check::done();
示例14: Bravo
<?php
require "tests.php";
require "director_frob.php";
// No new functions
check::functions(array(alpha_abs_method, bravo_abs_method, charlie_abs_method, ops_opint, ops_opintstarstarconst, ops_opintamp, ops_opintstar, ops_opconstintintstar, prims_ull, prims_callull, corecallbacks_on3dengineredrawn, corecallbacks_on3dengineredrawn2));
// No new classes
check::classes(array(Alpha, Bravo, Charlie, Delta, Ops, Prims, corePoint3d, coreCallbacks_On3dEngineRedrawnData, coreCallbacksOn3dEngineRedrawnData, coreCallbacks));
// now new vars
check::globals(array(corecallbacks_on3dengineredrawndata__eye, corecallbacks_on3dengineredrawndata__at, corecallbackson3dengineredrawndata__eye, corecallbackson3dengineredrawndata__at));
$foo = new Bravo();
$s = $foo->abs_method();
check::equal($s, "Bravo::abs_method()", "s failed");
check::done();
示例15: Spam
<?php
require "tests.php";
require "abstract_inherit_ok.php";
check::classes(array(Foo, Spam));
$spam = new Spam();
check::equal(0, $spam->blah(), "spam object method");
check::done();