<?php require "tests.php"; require "director_basic.php"; // No new functions check::functions(array(foo_ping, foo_pong, foo_get_self, a_f, a_rg, a1_ff, myclass_method, myclass_vmethod, myclass_pmethod, myclass_cmethod, myclass_get_self, myclass_call_pmethod, myclasst_i_method)); // No new classes check::classes(array(Foo, A, A1, Bar, MyClass, MyClassT_i)); // now new vars check::globals(array(bar_x)); class PhpFoo extends Foo { function ping() { 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;
<?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();
<?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();
<?php require "tests.php"; require "prefix.php"; // No new functions check::functions(array(foo_get_self)); // No new classes check::classes(array(ProjectFoo)); // now new vars check::globals(array()); $f = new ProjectFoo(); // This resulted in "Fatal error: Class 'Foo' not found" $f->get_self(); check::done();
<?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();
<?php require "tests.php"; require "director_string.php"; // No new functions check::functions(array(a_get_first, a_call_get_first, a_string_length, a_process_text, a_call_process_func, stringvector_size, stringvector_is_empty, stringvector_clear, stringvector_push, stringvector_pop, stringvector_capacity, stringvector_reserve)); // No new classes check::classes(array(A, StringVector)); // now new vars check::globals(array(a, a_call, a_m_strings, stringvector)); class B extends A { function get_first() { return parent::get_first() . " world!"; } function process_text($string) { parent::process_text($string); $this->smem = "hello"; } } $b = new B("hello"); $b->get(0); check::equal($b->get_first(), "hello world!", "get_first failed"); $b->call_process_func(); check::equal($b->smem, "hello", "smem failed"); check::done();
<?php require "tests.php"; require "conversion_namespace.php"; check::classes(array("Foo", "Bar")); $bar = new Bar(); check::classname("bar", $bar); $foo = $bar->toFoo(); check::classname("foo", $foo); check::done();
<?php require "tests.php"; require "class_ignore.php"; check::functions(array(do_blah, new_bar, bar_blah, new_boo, boo_away, new_far, new_hoo)); check::classes(array(class_ignore, Bar, Boo, Far, Hoo)); // No new vars check::globals(array()); $bar = new bar(); do_blah($bar); check::classparent($bar, ""); check::done();
<?php require "tests.php"; require "director_classic.php"; // No new functions check::functions(array(being_id, person_id, child_id, grandchild_id, caller_delcallback, caller_setcallback, caller_resetcallback, caller_call, caller_baseclass)); // No new classes check::classes(array(Being, Person, Child, GrandChild, OrphanPerson, OrphanChild, Caller)); // now new vars check::globals(array()); class TargetLangPerson extends Person { function id() { $identifier = "TargetLangPerson"; return $identifier; } } class TargetLangChild extends Child { function id() { $identifier = "TargetLangChild"; return $identifier; } } class TargetLangGrandChild extends GrandChild { function id() { $identifier = "TargetLangGrandChild";
<?php require "tests.php"; require "sym.php"; // No new functions check::functions(array()); // No new classes check::classes(array(flim, flam)); // now new vars check::globals(array()); $flim = new flim(); $flam = new flam(); check::equal($flim->hulahoops(), "flim-jam", "flim()->hulahoops==flim-jam"); check::equal($flim->jar(), "flim-jar", "flim()->jar==flim-jar"); check::equal($flam->jam(), "flam-jam", "flam()->jam==flam-jam"); check::equal($flam->jar(), "flam-jar", "flam()->jar==flam-jar"); check::done();
<?php require "tests.php"; require "import_nomodule.php"; // No new functions check::functions(array(create_foo, delete_foo, test1, is_python_builtin)); // No new classes check::classes(array(import_nomodule, Bar)); // now new vars check::globals(array()); $f = import_nomodule::create_Foo(); import_nomodule::test1($f, 42); import_nomodule::delete_Foo($f); $b = new Bar(); import_nomodule::test1($b, 37); check::done();
<?php require "tests.php"; require "rename_scope.php"; check::classes(array("rename_scope", "Interface_UP", "Interface_BP", "Natural_UP", "Natural_BP", "Bucket")); check::classmethods("Interface_UP", array("__construct", "__set", "__isset", "__get")); check::classmethods("Interface_BP", array("__construct", "__set", "__isset", "__get")); check::classmethods("Natural_UP", array("__construct", "__set", "__isset", "__get", "rtest")); check::classmethods("Natural_BP", array("__construct", "__set", "__isset", "__get", "rtest")); check::classparent("Natural_UP", "Interface_UP"); check::classparent("Natural_BP", "Interface_BP"); check::done();
<?php require "tests.php"; require "add_link.php"; // No new functions, except the flat functions check::functions(array(new_foo, foo_blah)); check::classes(array(Foo)); $foo = new foo(); check::is_a($foo, foo); $foo_blah = $foo->blah(); check::is_a($foo_blah, foo); //fails, can't be called as a class method, should allow and make it nil? //$class_foo_blah=foo::blah(); //check::is_a($class_foo_blah,foo); check::done();
<?php require "tests.php"; require "director_nested.php"; // No new functions check::functions(array(foo_int_advance, foo_int_do_advance, bar_step, bar_do_advance, bar_do_step, foobar_int_get_value, foobar_int_get_name, foobar_int_name, foobar_int_get_self, foobar_int_do_advance, foobar_int_do_step)); // No new classes check::classes(array(Foo_int, Bar, FooBar_int)); // now new vars check::globals(array()); class A extends FooBar_int { function do_step() { return "A::do_step;"; } function get_value() { return "A::get_value"; } } $a = new A(); check::equal($a->step(), "Bar::step;Foo::advance;Bar::do_advance;A::do_step;", "Bad A virtual resolution"); class B extends FooBar_int { function do_advance() { return "B::do_advance;" . $this->do_step(); } function do_step() {
<?php require "tests.php"; require "template_construct.php"; check::classes(array(Foo_int)); $foo_int = new foo_int(3); check::is_a($foo_int, "foo_int", "Made a foo_int"); check::done();
<?php require "tests.php"; require "evil_diamond.php"; check::classes(array("evil_diamond", "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 //check::is_a("spam","baz"); check::done();
<?php require "tests.php"; require "threads_exception.php"; // Check functions check::functions(array(test_simple, test_message, test_hosed, test_unknown, test_multi, is_python_builtin)); // Check classes. check::classes(array(Exc, Test, threads_exception)); // Chek globals. check::globals(array(exc_code, exc_msg)); $t = new Test(); try { $t->unknown(); } catch (Exception $e) { check::equal($e->getMessage(), 'C++ A * exception thrown', ''); } try { $t->simple(); } catch (Exception $e) { check::equal($e->getCode(), 37, ''); } try { $t->message(); } catch (Exception $e) { check::equal($e->getMessage(), 'I died.', ''); } try { $t->hosed(); } catch (Exception $e) { check::equal($e->getMessage(), 'C++ Exc exception thrown', ''); }
<?php require "tests.php"; require "conversion_ns_template.php"; check::classes(array("conversion_ns_template", "Foo_One", "Bar_One", "Hi")); // this is too hard, I'm not sure what to test for, check::done();
<?php require "tests.php"; require "director_finalizer.php"; // No new functions check::functions(array(foo_orstatus, deletefoo, getstatus, launder, resetstatus)); // No new classes check::classes(array(director_finalizer, Foo)); // now new vars check::globals(array()); class MyFoo extends Foo { function __destruct() { $this->orStatus(2); if (method_exists(parent, "__destruct")) { parent::__destruct(); } } } resetStatus(); $a = new MyFoo(); unset($a); check::equal(getStatus(), 3, "getStatus() failed #1"); resetStatus(); $a = new MyFoo(); launder($a); check::equal(getStatus(), 0, "getStatus() failed #2"); unset($a); check::equal(getStatus(), 3, "getStatus() failed #3"); resetStatus();
<?php require "tests.php"; require "director_exception.php"; // No new functions check::functions(array(foo_ping, foo_pong, launder, bar_ping, bar_pong, bar_pang, returnalltypes_return_int, returnalltypes_return_double, returnalltypes_return_const_char_star, returnalltypes_return_std_string, returnalltypes_return_bar, returnalltypes_call_int, returnalltypes_call_double, returnalltypes_call_const_char_star, returnalltypes_call_std_string, returnalltypes_call_bar, is_python_builtin)); // No new classes check::classes(array(director_exception, Foo, Exception1, Exception2, Base, Bar, ReturnAllTypes)); // now new vars check::globals(array()); class MyException extends Exception { function __construct($a, $b) { $this->msg = $a . $b; } } class MyFoo extends Foo { function ping() { throw new Exception("MyFoo::ping() EXCEPTION"); } } class MyFoo2 extends Foo { function ping() { return true; } }
<?php require "tests.php"; require "extend_template.php"; check::classes(array("Foo_0")); $foo = new Foo_0(); check::equal(2, $foo->test1(2), "test1"); check::equal(3, $foo->test2(3), "test2"); check::done();
<?php require "tests.php"; require "arrays.php"; check::functions(array(fn_taking_arrays, newintpointer, setintfrompointer, getintfrompointer, array_pointer_func)); check::classes(array(arrays, SimpleStruct, ArrayStruct, CartPoseData_t)); check::globals(array(simplestruct_double_field, arraystruct_array_c, arraystruct_array_sc, arraystruct_array_uc, arraystruct_array_s, arraystruct_array_us, arraystruct_array_i, arraystruct_array_ui, arraystruct_array_l, arraystruct_array_ul, arraystruct_array_ll, arraystruct_array_f, arraystruct_array_d, arraystruct_array_struct, arraystruct_array_structpointers, arraystruct_array_ipointers, arraystruct_array_enum, arraystruct_array_enumpointers, arraystruct_array_const_i, cartposedata_t_p)); $ss = new simplestruct(); check::classname(simplestruct, $ss); $as = new arraystruct(); $as->array_c = "abc"; check::equal($as->array_c, "a", '$as->array_c=="a"'); check::done();
<?php require "tests.php"; require "director_protected.php"; check::functions(array(foo_pong, foo_s, foo_q, foo_ping, foo_pang, foo_used, foo_cheer, bar_create, bar_callping, bar_callcheer, bar_cheer, bar_pong, bar_used, bar_ping, bar_pang, a_draw, b_draw)); check::classes(array(Foo, Bar, PrivateFoo, A, B, AA, BB)); check::globals(array(bar_a)); class FooBar extends Bar { protected function ping() { return "FooBar::ping();"; } } class FooBar2 extends Bar { function ping() { return "FooBar2::ping();"; } function pang() { return "FooBar2::pang();"; } } class FooBar3 extends Bar { function cheer() { return "FooBar3::cheer();"; }
<?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();
<?php require "tests.php"; require "php_iterator.php"; check::functions(array(myiterator_rewind, myiterator_key, myiterator_current, myiterator_next, myiterator_valid)); check::classes(array(MyIterator)); // No new global variables. check::globals(array()); $s = ''; foreach (new MyIterator(1, 6) as $i) { $s .= $i; } check::equal($s, '12345', 'Simple iteration failed'); $s = ''; foreach (new MyIterator(2, 5) as $k => $v) { $s .= "({$k}=>{$v})"; } check::equal($s, '(0=>2)(1=>3)(2=>4)', 'Simple iteration failed'); check::done();
<?php require "tests.php"; require "template_arg_typename.php"; // No new functions check::functions(array()); // No new classes check::classes(array(UnaryFunction_bool_bool, BoolUnaryFunction_bool)); $ufbb = new unaryfunction_bool_bool(); check::is_a($ufbb, "unaryfunction_bool_bool"); unset($whatisthis); $bufb = new boolunaryfunction_bool(&$whatisthis); check::is_a($bufb, "boolunaryfunction_bool"); check::done();
<?php require "tests.php"; require "exception_order.php"; check::functions(array(a_foo, a_bar, a_foobar, a_barfoo)); check::classes(array(A, E1, E2, E3, exception_order, ET_i, ET_d)); check::globals(array(efoovar, foovar, cfoovar, a_sfoovar, a_foovar, a_efoovar)); $a = new A(); try { $a->foo(); } catch (Exception $e) { check::equal($e->getMessage(), 'C++ E1 exception thrown', ''); } try { $a->bar(); } catch (Exception $e) { check::equal($e->getMessage(), 'C++ E2 exception thrown', ''); } try { $a->foobar(); } catch (Exception $e) { check::equal($e->getMessage(), 'postcatch unknown', ''); } try { $a->barfoo(1); } catch (Exception $e) { check::equal($e->getMessage(), 'C++ E1 exception thrown', ''); } try { $a->barfoo(2); } catch (Exception $e) {
<?php require "tests.php"; require "extend_template_ns.php"; check::classes(array("extend_template_ns", "Foo_One")); $foo = new Foo_One(); check::equal(2, $foo->test1(2), "test1"); check::equal(3, $foo->test2(3), "test2"); check::done();
<?php require "tests.php"; require "li_carrays.php"; // Check functions. check::functions(array(new_intarray, delete_intarray, intarray_getitem, intarray_setitem)); // Check classes. // NB An "li_carrays" class is created as a mock namespace. check::classes(array(li_carrays, doubleArray, AB, XY, XYArray)); // No new global variables. check::globals(array()); $d = new doubleArray(10); $d->setitem(0, 7); $d->setitem(5, $d->getitem(0) + 3); check::equal($d->getitem(0) + $d->getitem(5), 17.0, "7+10==17"); check::done();
<?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();