コード例 #1
0
<?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) {
コード例 #2
0
<?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();
コード例 #3
0
ファイル: li_carrays_runme.php プロジェクト: daxiazh/swig
<?php

require "tests.php";
require "li_carrays.php";
// Check functions.
check::functions(array(new_intarray, delete_intarray, intarray_getitem, intarray_setitem, doublearray_getitem, doublearray_setitem, doublearray_cast, doublearray_frompointer, xyarray_getitem, xyarray_setitem, xyarray_cast, xyarray_frompointer, delete_abarray, abarray_getitem, abarray_setitem));
// Check classes.
// NB An "li_carrays" class is created as a mock namespace.
check::classes(array(li_carrays, doubleArray, AB, XY, XYArray));
// Check global variables.
check::globals(array(xy_x, xy_y, globalxyarray, ab_a, ab_b, globalabarray));
$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();
コード例 #4
0
<?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();
コード例 #5
0
<?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();";
    }
コード例 #6
0
<?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();
コード例 #7
0
<?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();
コード例 #8
0
ファイル: grouping_runme.php プロジェクト: daxiazh/swig
<?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();
コード例 #9
0
ファイル: arrays_runme.php プロジェクト: hj3938/crossbridge
<?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();
コード例 #10
0
<?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', '');
}
コード例 #11
0
ファイル: director_frob_runme.php プロジェクト: msornay/swig
<?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();
コード例 #12
0
<?php

require "tests.php";
require "arrays_global.php";
check::functions(array(test_a, test_b, new_simplestruct, new_material));
check::classes(array(arrays_global, 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, beginstring_fix44a, beginstring_fix44b, beginstring_fix44c, beginstring_fix44d, beginstring_fix44e, beginstring_fix44f, chitmat, hitmat_val, hitmat));
// The size of array_c is 2, but the last byte is \0, so we can only store a
// single byte string in it.
check::set(array_c, "Z");
check::equal("Z", check::get(array_c), "set array_c");
check::set(array_c, "xy");
check::equal("x", check::get(array_c), "set array_c");
check::set(array_c, "h");
check::equal("h", check::get(array_c), "set array_c");
check::done();
コード例 #13
0
<?php

require "tests.php";
require "director_unroll.php";
// No new functions
check::functions(array(foo_ping, foo_pong));
// No new classes
check::classes(array(Foo, Bar));
// now new vars
check::globals(array(bar));
class MyFoo extends Foo
{
    function ping()
    {
        return "MyFoo::ping()";
    }
}
$a = new MyFoo();
$b = new Bar();
$b->set($a);
$c = $b->get();
check::equal($a->this, $c->this, "this failed");
check::done();
コード例 #14
0
ファイル: cpp_static_runme.php プロジェクト: daxiazh/swig
<?php

require "tests.php";
require "cpp_static.php";
// New functions
check::functions(array(staticfunctiontest_static_func, staticfunctiontest_static_func_2, staticfunctiontest_static_func_3));
// New classes
check::classes(array(StaticMemberTest, StaticFunctionTest));
// New vars
check::globals(array(staticmembertest_static_int));
check::done();
コード例 #15
0
ファイル: arrays_scope_runme.php プロジェクト: msornay/swig
<?php

require "tests.php";
require "arrays_scope.php";
// New functions
check::functions(array(new_bar, bar_blah));
// New classes
check::classes(array(arrays_scope, Bar));
// New vars
check::globals(array(bar_adata, bar_bdata, bar_cdata));
$bar = new bar();
check::done();