diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/php | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/php')
63 files changed, 2003 insertions, 0 deletions
diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in new file mode 100644 index 0000000..9630512 --- /dev/null +++ b/Examples/test-suite/php/Makefile.in @@ -0,0 +1,61 @@ +####################################################################### +# Makefile for php test-suite +####################################################################### + +LANGUAGE = php +SCRIPTSUFFIX = _runme.php +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ + +CPP_TEST_CASES += \ + php_namewarn_rename \ + +include $(srcdir)/../common.mk + +# Overridden variables here +TARGETPREFIX =# Should be php_ for Windows, empty otherwise + +# Custom tests - tests with additional commandline options +prefix.cpptest: SWIGOPT += -prefix Project + +# write out tests without a _runme.php +missingcpptests: + for test in $(CPP_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done + +missingctests: + for test in $(C_TEST_CASES) ; do test -f $${test}_runme.php || echo $${test}; done + +missingtests: missingcpptests missingctests + +# Rules for the different types of tests +%.cpptest: + $(setup) + +$(swig_and_compile_cpp) + +$(run_testcase) + +%.ctest: + $(setup) + +$(swig_and_compile_c) + +$(run_testcase) + +%.multicpptest: + $(setup) + +$(swig_and_compile_multi_cpp) + +$(run_testcase) + +# Runs the testcase. Tries to run testcase_runme.php, and if that's not +# found, runs testcase.php, except for multicpptests. +run_testcase = \ + if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHPSCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL=$(RUNTOOL) php_run; \ + elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHPSCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*.php RUNTOOL=$(RUNTOOL) php_run; \ + fi + +# Clean: remove the generated .php file +%.clean: + @rm -f $*.php; + +clean: + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile php_clean diff --git a/Examples/test-suite/php/abstract_inherit_ok_runme.php b/Examples/test-suite/php/abstract_inherit_ok_runme.php new file mode 100644 index 0000000..c2d8649 --- /dev/null +++ b/Examples/test-suite/php/abstract_inherit_ok_runme.php @@ -0,0 +1,12 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/abstract_inherit_runme.php b/Examples/test-suite/php/abstract_inherit_runme.php new file mode 100644 index 0000000..3554e6f --- /dev/null +++ b/Examples/test-suite/php/abstract_inherit_runme.php @@ -0,0 +1,14 @@ +<?php + +require "tests.php"; +require "abstract_inherit.php"; + +check::classes(array(Foo,Bar,Spam,NRFilter_i,NRRCFilter_i,NRRCFilterpro_i,NRRCFilterpri_i)); +// This constructor attempt should fail as there isn't one +//$spam=new Spam(); + +//check::equal(0,$spam->blah(),"spam object method"); +//check::equal(0,Spam::blah($spam),"spam class method"); + +check::done(); +?> diff --git a/Examples/test-suite/php/add_link_runme.php b/Examples/test-suite/php/add_link_runme.php new file mode 100644 index 0000000..7523bd6 --- /dev/null +++ b/Examples/test-suite/php/add_link_runme.php @@ -0,0 +1,22 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/argout_runme.php b/Examples/test-suite/php/argout_runme.php new file mode 100644 index 0000000..1c9026b --- /dev/null +++ b/Examples/test-suite/php/argout_runme.php @@ -0,0 +1,37 @@ +<?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); +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); +// without reference, should fatal error so can't test here +//voidhandle($handle); +//check::isnull($handle,'$handle not null'); + +check::done(); +?> diff --git a/Examples/test-suite/php/arrayptr_runme.php b/Examples/test-suite/php/arrayptr_runme.php new file mode 100644 index 0000000..3b9baed --- /dev/null +++ b/Examples/test-suite/php/arrayptr_runme.php @@ -0,0 +1,14 @@ +<?php + +require "tests.php"; +require "arrayptr.php"; + +// No new functions +check::functions(array(foo)); +// No new classes +check::classes(array()); +// now new vars +check::globals(array()); + +check::done(); +?> diff --git a/Examples/test-suite/php/arrays_global_runme.php b/Examples/test-suite/php/arrays_global_runme.php new file mode 100644 index 0000000..7748786 --- /dev/null +++ b/Examples/test-suite/php/arrays_global_runme.php @@ -0,0 +1,19 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/arrays_global_twodim_runme.php b/Examples/test-suite/php/arrays_global_twodim_runme.php new file mode 100644 index 0000000..9f16a6c --- /dev/null +++ b/Examples/test-suite/php/arrays_global_twodim_runme.php @@ -0,0 +1,22 @@ +<?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)); +$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(); +?> diff --git a/Examples/test-suite/php/arrays_runme.php b/Examples/test-suite/php/arrays_runme.php new file mode 100644 index 0000000..7419504 --- /dev/null +++ b/Examples/test-suite/php/arrays_runme.php @@ -0,0 +1,18 @@ +<?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)); +// No new vars +check::globals(array()); + +$ss=new simplestruct(); +check::classname(simplestruct,$ss); + +$as=new arraystruct(); +$as->array_c="abc"; +check::equal($as->array_c,"ab",'$as->array_c=="ab"'); + +check::done(); +?> diff --git a/Examples/test-suite/php/arrays_scope_runme.php b/Examples/test-suite/php/arrays_scope_runme.php new file mode 100644 index 0000000..6d3eba7 --- /dev/null +++ b/Examples/test-suite/php/arrays_scope_runme.php @@ -0,0 +1,16 @@ +<?php + +require "tests.php"; +require "arrays_scope.php"; + +// No new functions +check::functions(array(new_bar,bar_blah)); +// No new classes +check::classes(array(arrays_scope,Bar)); +// now new vars +check::globals(array()); + +$bar=new bar(); + +check::done(); +?> diff --git a/Examples/test-suite/php/casts_runme.php b/Examples/test-suite/php/casts_runme.php new file mode 100644 index 0000000..10522dc --- /dev/null +++ b/Examples/test-suite/php/casts_runme.php @@ -0,0 +1,18 @@ +<?php + +require "tests.php"; +require "casts.php"; + +// No new functions +check::functions(array(new_a,a_hello,new_b)); +// No new classes +check::classes(array(A,B)); +// now new vars +check::globals(array()); + +# Make sure $b inherites hello() from class A +$b=new B(); +$b->hello(); + +check::done(); +?> diff --git a/Examples/test-suite/php/char_strings_runme.php b/Examples/test-suite/php/char_strings_runme.php new file mode 100644 index 0000000..e06ee9d --- /dev/null +++ b/Examples/test-suite/php/char_strings_runme.php @@ -0,0 +1,43 @@ +<?php + +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(); +?> diff --git a/Examples/test-suite/php/class_ignore_runme.php b/Examples/test-suite/php/class_ignore_runme.php new file mode 100644 index 0000000..d5ce362 --- /dev/null +++ b/Examples/test-suite/php/class_ignore_runme.php @@ -0,0 +1,16 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/conversion_namespace_runme.php b/Examples/test-suite/php/conversion_namespace_runme.php new file mode 100644 index 0000000..e21ff74 --- /dev/null +++ b/Examples/test-suite/php/conversion_namespace_runme.php @@ -0,0 +1,13 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/conversion_ns_template_runme.php b/Examples/test-suite/php/conversion_ns_template_runme.php new file mode 100644 index 0000000..9702eed --- /dev/null +++ b/Examples/test-suite/php/conversion_ns_template_runme.php @@ -0,0 +1,10 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/conversion_runme.php b/Examples/test-suite/php/conversion_runme.php new file mode 100644 index 0000000..1a10ff4 --- /dev/null +++ b/Examples/test-suite/php/conversion_runme.php @@ -0,0 +1,13 @@ +<?php + +require "tests.php"; +require "conversion.php"; + +check::classes(array("Foo","Bar")); +$bar=new Bar; +check::classname("bar",$bar); +$foo=$bar->toFoo(); +check::classname("foo",$foo); + +check::done(); +?> diff --git a/Examples/test-suite/php/cpp_static_runme.php b/Examples/test-suite/php/cpp_static_runme.php new file mode 100644 index 0000000..9292a63 --- /dev/null +++ b/Examples/test-suite/php/cpp_static_runme.php @@ -0,0 +1,14 @@ +<?php + +require "tests.php"; +require "cpp_static.php"; + +// No new functions +check::functions(array()); +// No new classes +check::classes(array(StaticMemberTest,StaticFunctionTest)); +// now new vars +check::globals(array()); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_abstract_runme.php b/Examples/test-suite/php/director_abstract_runme.php new file mode 100644 index 0000000..ca3d676 --- /dev/null +++ b/Examples/test-suite/php/director_abstract_runme.php @@ -0,0 +1,62 @@ +<?php + +require "tests.php"; +require "director_abstract.php"; + +// No new functions +check::functions(array(foo_ping,foo_pong,example0_getxsize,example0_color,example0_get_color,example1_getxsize,example1_color,example1_get_color,example2_getxsize,example2_color,example2_get_color,example4_getxsize,example4_color,example4_get_color,example3_i_color,example3_i_get_color,g,a_f)); +// No new classes +check::classes(array(director_abstract,Foo,Example0,Example1,Example2,Example4,Example3_i,A)); +// now new vars +check::globals(array()); + +class MyFoo extends Foo { + function ping() { + return "MyFoo::ping()"; + } +} + +$a = new MyFoo(); + +check::equal($a->ping(), "MyFoo::ping()", "MyFoo::ping failed"); + +check::equal($a->pong(), "Foo::pong();MyFoo::ping()", "MyFoo::pong failed"); + +class MyExample1 extends Example1 { + function Color($r, $g, $b) { + return $r; + } +} + +class MyExample2 extends Example1 { + function Color($r, $g, $b) { + return $g; + } +} + +class MyExample3 extends Example1 { + function Color($r, $g, $b) { + return $b; + } +} + +$me1 = new MyExample1(); +check::equal($me1->Color(1, 2, 3), 1, "Example1_get_color failed"); + +$me2 = new MyExample2(1, 2); +check::equal($me2->Color(1, 2, 3), 2, "Example2_get_color failed"); + +$me3 = new MyExample3(); +check::equal($me3->Color(1, 2, 3), 3, "Example3_get_color failed"); + +$class = new ReflectionClass('Example1'); +check::equal($class->isAbstract(), true, "Example1 abstractness failed"); + +$class = new ReflectionClass('Example2'); +check::equal($class->isAbstract(), true, "Example2 abstractness failed"); + +$class = new ReflectionClass('Example3_i'); +check::equal($class->isAbstract(), true, "Example3_i abstractness failed"); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_basic_runme.php b/Examples/test-suite/php/director_basic_runme.php new file mode 100644 index 0000000..de6b505 --- /dev/null +++ b/Examples/test-suite/php/director_basic_runme.php @@ -0,0 +1,58 @@ +<?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; + } +} + +$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(); +?> diff --git a/Examples/test-suite/php/director_classic_runme.php b/Examples/test-suite/php/director_classic_runme.php new file mode 100644 index 0000000..d2da1b1 --- /dev/null +++ b/Examples/test-suite/php/director_classic_runme.php @@ -0,0 +1,150 @@ +<?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"; + return $identifier; + } +} + +# Semis - don't override id() in target language +class TargetLangSemiPerson extends Person { + # No id() override +} + +class TargetLangSemiChild extends Child { + # No id() override +} + +class TargetLangSemiGrandChild extends GrandChild { + # No id() override +} + +# Orphans - don't override id() in C++ +class TargetLangOrphanPerson extends OrphanPerson { + function id() { + $identifier = "TargetLangOrphanPerson"; + return $identifier; + } +} + +class TargetLangOrphanChild extends OrphanChild { + function id() { + $identifier = "TargetLangOrphanChild"; + return $identifier; + } +} + +function mycheck($person, $expected) { + $debug = 0; + # Normal target language polymorphic call + $ret = $person->id(); + if ($debug) + print $ret . "\n"; + check::equal($ret, $expected, "#1 failed"); + + # Polymorphic call from C++ + $caller = new Caller(); + $caller->setCallback($person); + $ret = $caller->call(); + if ($debug) + print $ret . "\n"; + check::equal($ret, $expected, "#2 failed"); + + # Polymorphic call of object created in target language and passed to + # C++ and back again + $baseclass = $caller->baseClass(); + $ret = $baseclass->id(); + if ($debug) + print $ret . "\n"; + # TODO: Currently we do not track the dynamic type of returned + # objects, so in case it's possible that the dynamic type is not equal + # to the static type, we skip this check. + if (get_parent_class($person) === false) + check::equal($ret, $expected, "#3 failed"); + + $caller->resetCallback(); + if ($debug) + print "----------------------------------------\n"; +} + +$person = new Person(); +mycheck($person, "Person"); +unset($person); + +$person = new Child(); +mycheck($person, "Child"); +unset($person); + +$person = new GrandChild(); +mycheck($person, "GrandChild"); +unset($person); + +$person = new TargetLangPerson(); +mycheck($person, "TargetLangPerson"); +unset($person); + +$person = new TargetLangChild(); +mycheck($person, "TargetLangChild"); +unset($person); + +$person = new TargetLangGrandChild(); +mycheck($person, "TargetLangGrandChild"); +unset($person); + +# Semis - don't override id() in target language +$person = new TargetLangSemiPerson(); +mycheck($person, "Person"); +unset($person); + +$person = new TargetLangSemiChild(); +mycheck($person, "Child"); +unset($person); + +$person = new TargetLangSemiGrandChild(); +mycheck($person, "GrandChild"); +unset($person); + +# Orphans - don't override id() in C++ +$person = new OrphanPerson(); +mycheck($person, "Person"); +unset($person); + +$person = new OrphanChild(); +mycheck($person, "Child"); +unset($person); + +$person = new TargetLangOrphanPerson(); +mycheck($person, "TargetLangOrphanPerson"); +unset($person); + +$person = new TargetLangOrphanChild(); +mycheck($person, "TargetLangOrphanChild"); +unset($person); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_default_runme.php b/Examples/test-suite/php/director_default_runme.php new file mode 100644 index 0000000..f97fc74 --- /dev/null +++ b/Examples/test-suite/php/director_default_runme.php @@ -0,0 +1,20 @@ +<?php + +require "tests.php"; +require "director_default.php"; + +// No new functions +check::functions(array(foo_msg,foo_getmsg,bar_msg,bar_getmsg,defaultsbase_defaultargs,defaultsderived_defaultargs)); +// No new classes +check::classes(array(Foo,Bar,DefaultsBase,DefaultsDerived)); +// now new vars +check::globals(array()); + +$f = new Foo(); +$f = new Foo(1); + +$f = new Bar(); +$f = new Bar(1); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_detect_runme.php b/Examples/test-suite/php/director_detect_runme.php new file mode 100644 index 0000000..cc19c03 --- /dev/null +++ b/Examples/test-suite/php/director_detect_runme.php @@ -0,0 +1,55 @@ +<?php + +require "tests.php"; +require "director_detect.php"; + +// No new functions +check::functions(array(foo_cloner,foo_get_value,foo_get_class,foo_just_do_it,bar_baseclass,bar_cloner,bar_get_value,bar_get_class,bar_just_do_it)); +// No new classes +check::classes(array(A,Foo,Bar)); +// now new vars +check::globals(array()); + +class MyBar extends Bar { + function __construct($val = 2) { + parent::__construct(); + $this->val = $val; + } + + function get_value() { + $this->val = $this->val + 1; + return $this->val; + } + + function get_class() { + $this->val = $this->val + 1; + return new A(); + } + + function just_do_it() { + $this->val = $this->val + 1; + } + + /* clone is a reserved keyword */ + function clone_() { + return new MyBar($this->val); + } +} + +$b = new MyBar(); + +$f = $b->baseclass(); + +$v = $f->get_value(); +$a = $f->get_class(); +$f->just_do_it(); + +$c = $b->clone_(); +$vc = $c->get_value(); + +check::equal($v, 3, "f: Bad virtual detection"); +check::equal($b->val, 5, "b: Bad virtual detection"); +check::equal($vc, 6, "c: Bad virtual detection"); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_enum_runme.php b/Examples/test-suite/php/director_enum_runme.php new file mode 100644 index 0000000..8f6487a --- /dev/null +++ b/Examples/test-suite/php/director_enum_runme.php @@ -0,0 +1,25 @@ +<?php + +require "tests.php"; +require "director_enum.php"; + +// No new functions +check::functions(array(foo_say_hello,foo_say_hi,foo_say_bye,foo_say_hi_ref,foo_ping,foo_ping_ref,foo_ping_member_enum,a_f,a2_f)); +// No new classes +check::classes(array(director_enum,Foo,A,B,A2,B2)); +// now new vars +check::globals(array()); + +class MyFoo extends Foo { + function say_hi($val) { + return $val; + } +} + +$b = new Foo(); +$a = new MyFoo(); + +check::equal($a->say_hi(director_enum::hello), $b->say_hello(director_enum::hi), "say failed"); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php new file mode 100644 index 0000000..33e6e9b --- /dev/null +++ b/Examples/test-suite/php/director_exception_runme.php @@ -0,0 +1,78 @@ +<?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)); +// No new classes +check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar)); +// 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; + } +} + +class MyFoo3 extends Foo { + function ping() { + throw new MyException("foo", "bar"); + } +} + +# Check that the Exception raised by MyFoo.ping() is returned by +# MyFoo.pong(). +$ok = 0; +$a = new MyFoo(); +# TODO: Currently we do not track the dynamic type of returned +# objects, so we skip the launder() call. +#$b = director_exception::launder($a); +$b = $a; +try { + $b->pong(); +} catch (Exception $e) { + $ok = 1; + check::equal($e->getMessage(), "MyFoo::ping() EXCEPTION", "Unexpected error message #1"); +} +check::equal($ok, 1, "Got no exception while expected one #1"); + +# Check that the director can return an exception which requires two +# arguments to the constructor, without mangling it. +$ok = 0; +$a = new MyFoo3(); +#$b = director_exception::launder($a); +$b = $a; +try { + $b->pong(); +} catch (Exception $e) { + $ok = 1; + check::equal($e->msg, "foobar", "Unexpected error message #2"); +} +check::equal($ok, 1, "Got no exception while expected one #2"); + +try { + throw new Exception2(); +} catch (Exception2 $e2) { +} + +try { + throw new Exception1(); +} catch (Exception1 $e1) { +} + +check::done(); +?> diff --git a/Examples/test-suite/php/director_extend_runme.php b/Examples/test-suite/php/director_extend_runme.php new file mode 100644 index 0000000..f283aef --- /dev/null +++ b/Examples/test-suite/php/director_extend_runme.php @@ -0,0 +1,24 @@ +<?php + +require "tests.php"; +require "director_extend.php"; + +// No new functions +check::functions(array(spobject_getfoobar,spobject_dummy,spobject_exceptionmethod)); +// No new classes +check::classes(array(SpObject)); +// now new vars +check::globals(array()); + +class MyObject extends SpObject{ + function getFoo() { + return 123; + } +} + +$m = new MyObject(); +check::equal($m->dummy(), 666, "1st call"); +check::equal($m->dummy(), 666, "2st call"); // Locked system + +check::done(); +?> diff --git a/Examples/test-suite/php/director_finalizer_runme.php b/Examples/test-suite/php/director_finalizer_runme.php new file mode 100644 index 0000000..0fcddfd --- /dev/null +++ b/Examples/test-suite/php/director_finalizer_runme.php @@ -0,0 +1,61 @@ +<?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(); + +$a = new MyFoo(); +$a->thisown = 0; +deleteFoo($a); +unset($a); + +check::equal(getStatus(), 3, "getStatus() failed #4"); + +resetStatus(); + +$a = new MyFoo(); +$a->thisown = 0; +deleteFoo(launder($a)); +unset($a); + +check::equal(getStatus(), 3, "getStatus() failed #5"); + +resetStatus(); + +check::done(); +?> diff --git a/Examples/test-suite/php/director_frob_runme.php b/Examples/test-suite/php/director_frob_runme.php new file mode 100644 index 0000000..548b0b8 --- /dev/null +++ b/Examples/test-suite/php/director_frob_runme.php @@ -0,0 +1,19 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/director_nested_runme.php b/Examples/test-suite/php/director_nested_runme.php new file mode 100644 index 0000000..4965e94 --- /dev/null +++ b/Examples/test-suite/php/director_nested_runme.php @@ -0,0 +1,74 @@ +<?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() { + return "B::do_step;"; + } + + function get_value() { + return 1; + } +} + +$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(); +?> diff --git a/Examples/test-suite/php/director_profile_runme.php b/Examples/test-suite/php/director_profile_runme.php new file mode 100644 index 0000000..c724213 --- /dev/null +++ b/Examples/test-suite/php/director_profile_runme.php @@ -0,0 +1,53 @@ +<?php + +require "tests.php"; +require "director_profile.php"; + +// No new functions +check::functions(array(b_fn,b_vfi,b_fi,b_fj,b_fk,b_fl,b_get_self,b_vfs,b_fs)); +// No new classes +check::classes(array(A,B)); +// now new vars +check::globals(array()); + +class MyB extends B { + function vfi($a) { + return $a+3; + } +} + +$a = new A(); +$myb = new MyB(); +$b = B::get_self($myb); + +$i = 50000; +$a = 1; + +while ($i) { + $a = $b->fi($a); #1 + $a = $b->fi($a); #2 + $a = $b->fi($a); #3 + $a = $b->fi($a); #4 + $a = $b->fi($a); #5 + $a = $b->fi($a); #6 + $a = $b->fi($a); #7 + $a = $b->fi($a); #8 + $a = $b->fi($a); #9 + $a = $b->fi($a); #10 + $a = $b->fi($a); #1 + $a = $b->fi($a); #2 + $a = $b->fi($a); #3 + $a = $b->fi($a); #4 + $a = $b->fi($a); #5 + $a = $b->fi($a); #6 + $a = $b->fi($a); #7 + $a = $b->fi($a); #8 + $a = $b->fi($a); #9 + $a = $b->fi($a); #20 + $i -= 1; +} + +print $a . "\n"; + +check::done(); +?> diff --git a/Examples/test-suite/php/director_protected_runme.php b/Examples/test-suite/php/director_protected_runme.php new file mode 100644 index 0000000..73bcba1 --- /dev/null +++ b/Examples/test-suite/php/director_protected_runme.php @@ -0,0 +1,54 @@ +<?php + +require "tests.php"; +require "director_protected.php"; + +// No new functions +check::functions(array(foo_pong,foo_s,foo_q,foo_ping,foo_pang,foo_used,bar_create,bar_pong,bar_used,bar_ping,bar_pang,a_draw,b_draw)); +// No new classes +check::classes(array(Foo,Bar,PrivateFoo,A,B,AA,BB)); +// now new vars +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();"; + } +} + +$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(); +?> diff --git a/Examples/test-suite/php/director_stl_runme.php b/Examples/test-suite/php/director_stl_runme.php new file mode 100644 index 0000000..29addd2 --- /dev/null +++ b/Examples/test-suite/php/director_stl_runme.php @@ -0,0 +1,60 @@ +<?php + +require "tests.php"; +require "director_stl.php"; + +// No new functions +check::functions(array(foo_bar,foo_ping,foo_pong,foo_tping,foo_tpong,foo_pident,foo_vident,foo_vsecond,foo_tpident,foo_tvident,foo_tvsecond,foo_vidents,foo_tvidents)); +// No new classes +check::classes(array(Foo)); +// now new vars +check::globals(array()); + +class MyFoo extends Foo { + function ping($s) { + return "MyFoo::ping():" . $s; + } + + function pident($arg) { + return $arg; + } + + function vident($v) { + return $v; + } + + function vidents($v) { + return $v; + } + + function vsecond($v1, $v2) { + return $v2; + } +} + +$a = new MyFoo(); + +$a->tping("hello"); +$a->tpong("hello"); + +# TODO: automatic conversion between PHP arrays and std::pair or +# std::vector is not yet implemented. +/*$p = array(1, 2); +$a->pident($p); +$v = array(3, 4); +$a->vident($v); + +$a->tpident($p); +$a->tvident($v); + +$v1 = array(3, 4); +$v2 = array(5, 6); + +$a->tvsecond($v1, $v2); + +$vs = array("hi", "hello"); +$vs; +$a->tvidents($vs);*/ + +check::done(); +?> diff --git a/Examples/test-suite/php/director_string_runme.php b/Examples/test-suite/php/director_string_runme.php new file mode 100644 index 0000000..5ac583f --- /dev/null +++ b/Examples/test-suite/php/director_string_runme.php @@ -0,0 +1,34 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/director_thread_runme.php b/Examples/test-suite/php/director_thread_runme.php new file mode 100644 index 0000000..8df25d9 --- /dev/null +++ b/Examples/test-suite/php/director_thread_runme.php @@ -0,0 +1,29 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/director_unroll_runme.php b/Examples/test-suite/php/director_unroll_runme.php new file mode 100644 index 0000000..626b1f0 --- /dev/null +++ b/Examples/test-suite/php/director_unroll_runme.php @@ -0,0 +1,29 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/enum_scope_template_runme.php b/Examples/test-suite/php/enum_scope_template_runme.php new file mode 100644 index 0000000..e152efc --- /dev/null +++ b/Examples/test-suite/php/enum_scope_template_runme.php @@ -0,0 +1,15 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/evil_diamond_ns_runme.php b/Examples/test-suite/php/evil_diamond_ns_runme.php new file mode 100644 index 0000000..fcce0f7 --- /dev/null +++ b/Examples/test-suite/php/evil_diamond_ns_runme.php @@ -0,0 +1,18 @@ +<?php + +require "tests.php"; +require "evil_diamond_ns.php"; + +check::classes(array("evil_diamond_ns","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"); +$spam=new spam(); +$_spam=test($spam); + +check::done(); +?> diff --git a/Examples/test-suite/php/evil_diamond_prop_runme.php b/Examples/test-suite/php/evil_diamond_prop_runme.php new file mode 100644 index 0000000..02d9944 --- /dev/null +++ b/Examples/test-suite/php/evil_diamond_prop_runme.php @@ -0,0 +1,38 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/evil_diamond_runme.php b/Examples/test-suite/php/evil_diamond_runme.php new file mode 100644 index 0000000..a587ca3 --- /dev/null +++ b/Examples/test-suite/php/evil_diamond_runme.php @@ -0,0 +1,16 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/extend_template_ns_runme.php b/Examples/test-suite/php/extend_template_ns_runme.php new file mode 100644 index 0000000..e6d3e9f --- /dev/null +++ b/Examples/test-suite/php/extend_template_ns_runme.php @@ -0,0 +1,12 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/extend_template_runme.php b/Examples/test-suite/php/extend_template_runme.php new file mode 100644 index 0000000..41bde44 --- /dev/null +++ b/Examples/test-suite/php/extend_template_runme.php @@ -0,0 +1,12 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/grouping_runme.php b/Examples/test-suite/php/grouping_runme.php new file mode 100644 index 0000000..51446f4 --- /dev/null +++ b/Examples/test-suite/php/grouping_runme.php @@ -0,0 +1,22 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/ignore_parameter_runme.php b/Examples/test-suite/php/ignore_parameter_runme.php new file mode 100644 index 0000000..d455c39 --- /dev/null +++ b/Examples/test-suite/php/ignore_parameter_runme.php @@ -0,0 +1,38 @@ +<?php + +require "tests.php"; +require "ignore_parameter.php"; + +// No new functions +check::functions(array(jaguar,lotus,tvr,ferrari)); +// No new classes +check::classes(array(sportscars,minicooper,morrisminor,fordanglia,austinallegro)); +// now new vars +check::globals(array()); + +check::equal(jaguar(2,3.4),"hello",'jaguar(2,3.4)=="hello"'); +check::equal(lotus("eek",3.4),101,'lotus("eek",3.4)==101'); +check::equal(tvr("eek",2),8.8,'tvr("eek",2)==8.8'); +check::equal(ferrari(),101,'ferrari(2)==101'); + +$sc=new sportscars(); +check::classname("sportscars",$sc); +check::equal($sc->daimler(2,3.4),"hello",'$sc->daimler(2,3.4)=="hello"'); +check::equal($sc->astonmartin("eek",3.4),101,'$sc->mastonmartin("eek",3.4)==101'); +check::equal($sc->bugatti("eek",2),8.8,'$sc->bugatti("eek",2)==8.8'); +check::equal($sc->lamborghini(),101,'$sc->lamborghini(2)==101'); + +$mc=new minicooper(2,3.4); +check::classname("minicooper",$mc); + +$mm=new morrisminor("eek",3.4); +check::classname("morrisminor",$mm); + +$fa=new fordanglia("eek",2); +check::classname("fordanglia",$fa); + +$aa=new austinallegro(); +check::classname("austinallegro",$aa); + +check::done(); +?> diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php new file mode 100644 index 0000000..84191fb --- /dev/null +++ b/Examples/test-suite/php/import_nomodule_runme.php @@ -0,0 +1,20 @@ +<?php +require "tests.php"; +require "import_nomodule.php"; + +// No new functions +check::functions(array(create_foo,delete_foo,test1)); +// 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(); +?> diff --git a/Examples/test-suite/php/li_carrays_runme.php b/Examples/test-suite/php/li_carrays_runme.php new file mode 100644 index 0000000..b6d47e9 --- /dev/null +++ b/Examples/test-suite/php/li_carrays_runme.php @@ -0,0 +1,22 @@ +<?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., "7+10==17"); + +check::done(); +?> diff --git a/Examples/test-suite/php/li_factory_runme.php b/Examples/test-suite/php/li_factory_runme.php new file mode 100644 index 0000000..6623e2a --- /dev/null +++ b/Examples/test-suite/php/li_factory_runme.php @@ -0,0 +1,22 @@ +<?php + +require "tests.php"; +require "li_factory.php"; + +// No new functions +check::functions(array(geometry_draw,geometry_create,geometry_clone_,point_draw,point_width,point_clone_,circle_draw,circle_radius,circle_clone_)); +// No new classes +check::classes(array(Geometry,Point,Circle)); +// now new vars +check::globals(array()); + +$circle = Geometry::create(Geometry::CIRCLE); +$r = $circle->radius(); +check::equal($r, 1.5, "r failed"); + +$point = Geometry::create(Geometry::POINT); +$w = $point->width(); +check::equal($w, 1.0, "w failed"); + +check::done(); +?> diff --git a/Examples/test-suite/php/li_std_string_runme.php b/Examples/test-suite/php/li_std_string_runme.php new file mode 100644 index 0000000..ad62247 --- /dev/null +++ b/Examples/test-suite/php/li_std_string_runme.php @@ -0,0 +1,31 @@ +<?php + +require "tests.php"; +require "li_std_string.php"; + +// Global variables +//$s="initial string"; +//check::equal(GlobalString2_get() ,"global string 2", "GlobalString2 test 1"); + +// Global variables +$s = "initial string"; +check::equal(GlobalString2_get(), "global string 2", "GlobalString2 test 1"); +GlobalString2_set($s); +check::equal(GlobalString2_get(), $s, "GlobalString2 test 2"); +check::equal(ConstGlobalString_get(), "const global string", "ConstGlobalString test"); + +// Member variables +$myStructure = new Structure(); +check::equal($myStructure->MemberString2, "member string 2", "MemberString2 test 1"); +$myStructure->MemberString2 = $s; +check::equal($myStructure->MemberString2, $s, "MemberString2 test 2"); +check::equal($myStructure->ConstMemberString, "const member string", "ConstMemberString test"); + +check::equal(Structure::StaticMemberString2(), "static member string 2", "StaticMemberString2 test 1"); +Structure::StaticMemberString2($s); +check::equal(Structure::StaticMemberString2(), $s, "StaticMemberString2 test 2"); +// below broken ? +//check::equal(Structure::ConstStaticMemberString(), "const static member string", "ConstStaticMemberString test"); + +check::done(); +?> diff --git a/Examples/test-suite/php/newobject1_runme.php b/Examples/test-suite/php/newobject1_runme.php new file mode 100644 index 0000000..5853a72 --- /dev/null +++ b/Examples/test-suite/php/newobject1_runme.php @@ -0,0 +1,19 @@ +<?php + +require "tests.php"; +require "newobject1.php"; + +// No new functions +check::functions(array(foo_makefoo,foo_makemore,foo_foocount)); +// No new classes +check::classes(array(Foo)); +// now new vars +check::globals(array()); + +$foo = Foo::makeFoo(); +check::equal(get_class($foo), "Foo", "static failed"); +$bar = $foo->makeMore(); +check::equal(get_class($bar), "Foo", "regular failed"); + +check::done(); +?> diff --git a/Examples/test-suite/php/overload_rename_runme.php b/Examples/test-suite/php/overload_rename_runme.php new file mode 100644 index 0000000..dce4c6c --- /dev/null +++ b/Examples/test-suite/php/overload_rename_runme.php @@ -0,0 +1,19 @@ +<?php + +require "tests.php"; +require "overload_rename.php"; + +// No new functions +check::functions(array()); +// No new classes +check::classes(array(Foo)); +// now new vars +check::globals(array()); + +$f = new Foo(1.0); +$f = new Foo(1.0,1.0); +$f = Foo::Foo_int(1.0,1); +$f = Foo::Foo_int(1.0,1,1.0); + +check::done(); +?> diff --git a/Examples/test-suite/php/pointer_reference_runme.php b/Examples/test-suite/php/pointer_reference_runme.php new file mode 100644 index 0000000..782760a --- /dev/null +++ b/Examples/test-suite/php/pointer_reference_runme.php @@ -0,0 +1,15 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/prefix_runme.php b/Examples/test-suite/php/prefix_runme.php new file mode 100644 index 0000000..ead064f --- /dev/null +++ b/Examples/test-suite/php/prefix_runme.php @@ -0,0 +1,18 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/primitive_ref_runme.php b/Examples/test-suite/php/primitive_ref_runme.php new file mode 100644 index 0000000..6a5a3f4 --- /dev/null +++ b/Examples/test-suite/php/primitive_ref_runme.php @@ -0,0 +1,25 @@ +<?php + +require "tests.php"; +require "primitive_ref.php"; + +check::equal(ref_over(3), 3, "ref_over failed"); + +check::equal(ref_int(3), 3, "ref_int failed"); +check::equal(ref_uint(3), 3, "ref_uint failed"); +check::equal(ref_short(3), 3, "ref_short failed"); +check::equal(ref_ushort(3), 3, "ref_ushort failed"); +check::equal(ref_long(3), 3, "ref_long failed"); +check::equal(ref_ulong(3), 3, "ref_ulong failed"); +check::equal(ref_schar(3), 3, "ref_schar failed"); +check::equal(ref_uchar(3), 3, "ref_uchar failed"); +check::equal(ref_bool(true), true, "ref_bool failed"); +check::equal(ref_float(3.5), 3.5, "ref_float failed"); +check::equal(ref_double(3.5), 3.5, "ref_double failed"); +check::equal(ref_char('x'), 'x', "ref_char failed"); +//check::equal(ref_longlong(0x123456789ABCDEF0), 0x123456789ABCDEF0, "ref_longlong failed"); +//check::equal(ref_ulonglong(0xF23456789ABCDEF0), 0xF23456789ABCDEF0, "ref_ulonglong failed"); +printf("TODO: long long and unsigned long long const reference typemaps\n"); + +check::done(); +?> diff --git a/Examples/test-suite/php/rename_scope_runme.php b/Examples/test-suite/php/rename_scope_runme.php new file mode 100644 index 0000000..df620d7 --- /dev/null +++ b/Examples/test-suite/php/rename_scope_runme.php @@ -0,0 +1,16 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/skel.php b/Examples/test-suite/php/skel.php new file mode 100644 index 0000000..780a999 --- /dev/null +++ b/Examples/test-suite/php/skel.php @@ -0,0 +1,15 @@ +<?php +// Sample test file + +require "tests.php"; +require "____.php"; + +// No new functions +check::functions(array()); +// No new classes +check::classes(array()); +// now new vars +check::globals(array()); + +check::done(); +?> diff --git a/Examples/test-suite/php/smart_pointer_rename_runme.php b/Examples/test-suite/php/smart_pointer_rename_runme.php new file mode 100644 index 0000000..26692dd --- /dev/null +++ b/Examples/test-suite/php/smart_pointer_rename_runme.php @@ -0,0 +1,27 @@ +<?php + +require "tests.php"; +require "smart_pointer_rename.php"; + +check::classes(array("Foo","Bar")); +check::classmethods("foo",array("ftest1","ftest2","__set","__isset","__get","__construct")); +check::classmethods("bar",array("__deref__","test","ftest1","ftest2","__set","__isset","__get","__construct")); +$foo=new foo(); +check::classname("foo",$foo); +$bar=new bar($foo); +check::classname("bar",$bar); + +# check foo's ftest1, ftest2 +check::equal(1,$foo->ftest1(1),"foo->ftest1"); +check::equal(2,$foo->ftest2(1,2),"foo->ftest2"); + +# check bar's ftest1, ftest2, ftest +check::equal(1,$bar->ftest1(1),"bar->ftest1"); +check::equal(2,$bar->ftest2(1,2),"bar->ftest2"); +check::equal(3,$bar->test(),"bar->test"); + +# check deref returns foo +check::classname("foo",$bar->__deref__()); + +check::done(); +?> diff --git a/Examples/test-suite/php/sym_runme.php b/Examples/test-suite/php/sym_runme.php new file mode 100644 index 0000000..483aaa9 --- /dev/null +++ b/Examples/test-suite/php/sym_runme.php @@ -0,0 +1,22 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/template_arg_typename_runme.php b/Examples/test-suite/php/template_arg_typename_runme.php new file mode 100644 index 0000000..87d07de --- /dev/null +++ b/Examples/test-suite/php/template_arg_typename_runme.php @@ -0,0 +1,18 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/template_construct_runme.php b/Examples/test-suite/php/template_construct_runme.php new file mode 100644 index 0000000..3a3986f --- /dev/null +++ b/Examples/test-suite/php/template_construct_runme.php @@ -0,0 +1,11 @@ +<?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(); +?> diff --git a/Examples/test-suite/php/tests.php b/Examples/test-suite/php/tests.php new file mode 100644 index 0000000..57c5c47 --- /dev/null +++ b/Examples/test-suite/php/tests.php @@ -0,0 +1,232 @@ +<?php + +// do we have true global vars or just GETSET functions? +// Used to filter out get/set global functions to fake vars... +define(GETSET,1); + +$_original_functions=get_defined_functions(); +$_original_globals=1; +$_original_classes=get_declared_classes(); +$_original_globals=array_keys($GLOBALS); + +class check { + function get_extra_classes($ref=FALSE) { + static $extra; + global $_original_classes; + if ($ref===FALSE) $f=$_original_classes; + if (! is_array($extra)) { + $df=array_flip(get_declared_classes()); + foreach($_original_classes as $class) unset($df[$class]); + $extra=array_keys($df); + } + return $extra; + } + + function get_extra_functions($ref=FALSE,$gs=false) { + static $extra; + static $extrags; // for get/setters + global $_original_functions; + if ($ref===FALSE) $f=$_original_functions; + if (! is_array($extra) || $gs) { + $extra=array(); + $extrags=array(); + $df=get_defined_functions(); + $df=array_flip($df[internal]); + foreach($_original_functions[internal] as $func) unset($df[$func]); + // Now chop out any get/set accessors + foreach(array_keys($df) as $func) + if ((GETSET && ereg('_[gs]et$',$func)) || ereg('^new_', $func) + || ereg('_(alter|get)_newobject$', $func)) + $extrags[]=$func; + else $extra[]=$func; +// $extra=array_keys($df); + } + if ($gs) return $extrags; + return $extra; + } + + function get_extra_globals($ref=FALSE) { + static $extra; + global $_original_globals; + if (! is_array($extra)) { + if (GETSET) { + $_extra=array(); + foreach(check::get_extra_functions(false,1) as $global) { + if (ereg('^(.*)_[sg]et$',$global,$match)) $_extra[$match[1]]=1; + } + $extra=array_keys($_extra); + } else { + if ($ref===FALSE) $ref=$_original_globals; + if (! is_array($extra)) { + $df=array_flip(array_keys($GLOBALS)); + foreach($_original_globals as $func) unset($df[$func]); + // MASK xxxx_LOADED__ variables + foreach(array_keys($df) as $func) if (ereg('_LOADED__$',$func)) unset($df[$func]); + $extra=array_keys($df); + } + } + } + return $extra; + } + + function classname($string,$object) { + if (!is_object($object)) + return check::fail("The second argument is a " . gettype($object) . ", not an object."); + if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string); + return TRUE; + } + + function classmethods($classname,$methods) { + if (is_object($classname)) $classname=get_class($classname); + $classmethods=array_flip(get_class_methods($classname)); + $missing=array(); + $extra=array(); + foreach($methods as $method) { + if (! isset($classmethods[$method])) $missing[]=$method; + else unset($classmethods[$method]); + } + $extra=array_keys($classmethods); + if ($missing) $message[]="does not have these methods:\n ".join(",",$missing); + if ($message) { + return check::fail("Class %s %s\nFull class list:\n %s\n",$classname,join("\nbut ",$message),join("\n ",get_class_methods($classname))); + } + if ($extra) $message[]="Class ".$classname." has these extra methods:\n ".join(",",$extra); + if ($message) return check::warn(join("\n ",$message)); + return TRUE; + } + + function set($var,$value) { + $func=$var."_set"; + if (GETSET) $func($value); + else $_GLOBALS[$var]=$value; + } + + function &get($var) { + $func=$var."_get"; + if (GETSET) return $func(); + else return $_GLOBALS[$var]; + } + + function is_a($a,$b) { + if (is_object($a)) $a=strtolower(get_class($a)); + if (is_object($b)) $a=strtolower(get_class($b)); + $parents=array(); + $c=$a; + while($c!=$b && $c) { + $parents[]=$c; + $c=strtolower(get_parent_class($c)); + } + if ($c!=$b) return check::fail("Class $a does not inherit from class $b\nHierachy:\n %s\n",join("\n ",$parents)); + return TRUE; + } + + function classparent($a,$b) { + if (is_object($a)) $a=get_class($a); + if (is_object($b)) $a=get_class($b); + $parent=get_parent_class($a); + + if ($parent!=$b) return check::fail("Class $a parent not actually $b but $parent"); + return TRUE; + } + + function classes($classes) { + if (! is_array($classes)) $classes=array($classes); + $message=array(); + $missing=array(); + $extra=array_flip(check::get_extra_classes()); + foreach($classes as $class) { + if (! class_exists($class)) $missing[]=$class; + else unset($extra[$class]); + } + if ($missing) $message[]=sprintf("Classes missing: %s",join(",",$missing)); + if ($message) return check::fail(join("\n ",$message)); + if ($extra) $message[]=sprintf("These extra classes are defined: %s",join(",",array_keys($extra))); + if ($message) return check::warn(join("\n ",$message)); + return TRUE; + } + + function functions($functions) { + if (! is_array($functions)) $functions=array($functions); + $message=array(); + $missing=array(); + $extra=array_flip(check::get_extra_functions()); + + foreach ($functions as $func) { + if (! function_exists($func)) $missing[]=$func; + else unset($extra[$func]); + } + if ($missing) $message[]=sprintf("Functions missing: %s",join(",",$missing)); + if ($message) return check::fail(join("\n ",$message)); + if ($extra) $message[]=sprintf("These extra functions are defined: %s",join(",",array_keys($extra))); + if ($message) return check::warn(join("\n ",$message)); + return TRUE; + } + + function globals($globals) { + if (! is_array($globals)) $globals=array($globals); + $message=array(); + $missing=array(); + $extra=array_flip(check::get_extra_globals()); + foreach ($globals as $glob) { + if (GETSET) { + if (! isset($extra[$glob])) $missing[]=$glob; + else unset($extra[$glob]); + } else { + if (! isset($GLOBALS[$glob])) $missing[]=$glob; + else unset($extra[$glob]); + } + } + if ($missing) $message[]=sprintf("Globals missing: %s",join(",",$missing)); + if ($message) return check::fail(join("\n ",$message)); + if ($extra) $message[]=sprintf("These extra globals are defined: %s",join(",",array_keys($extra))); + if ($message) return check::warn(join("\n ",$message)); + return TRUE; + + } + + function functionref($a,$type,$message) { + if (! eregi("^_[a-f0-9]+$type$",$a)) return check::fail($message); + return TRUE; + } + + function equal($a,$b,$message) { + if (! ($a===$b)) return check::fail($message . ": '$a'!=='$b'"); + return TRUE; + } + + 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; + } + + function isnull($a,$message) { + $value=trim(check::var_dump($a)); + return check::equal($value,"NULL",$message); + } + + function var_dump($arg) { + ob_start(); + var_dump($arg); + $result=ob_get_contents(); + ob_end_clean(); + return $result; + } + + function fail($pattern) { + $args=func_get_args(); + print("Failed on: ".call_user_func_array("sprintf",$args)."\n"); + exit(1); + } + + function warn($pattern) { + $args=func_get_args(); + print("Warning on: ".call_user_func_array("sprintf",$args)."\n"); + return FALSE; + } + + function done() { +# print $_SERVER[argv][0]." ok\n"; + } +} +?> diff --git a/Examples/test-suite/php/typedef_reference_runme.php b/Examples/test-suite/php/typedef_reference_runme.php new file mode 100644 index 0000000..88a70f8 --- /dev/null +++ b/Examples/test-suite/php/typedef_reference_runme.php @@ -0,0 +1,13 @@ +<?php + +require "tests.php"; +require "typedef_reference.php"; + +check::functions(array(somefunc,otherfunc,new_intp,copy_intp,delete_intp,intp_assign,intp_value)); +$int2=copy_intp(2); +check::equal(2,somefunc($int2)," test passing intp to somefunc"); +$int3=copy_intp(3); +check::equal(3,otherfunc($int3)," test passing intp to otherfunc"); + +check::done(); +?> diff --git a/Examples/test-suite/php/typemap_ns_using_runme.php b/Examples/test-suite/php/typemap_ns_using_runme.php new file mode 100644 index 0000000..6a599f0 --- /dev/null +++ b/Examples/test-suite/php/typemap_ns_using_runme.php @@ -0,0 +1,9 @@ +<?php + +require "tests.php"; +require "typemap_ns_using.php"; +if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); +if (! 3==spam(3)) die("spam function not working right\n"); + +check::done(); +?> diff --git a/Examples/test-suite/php/using1_runme.php b/Examples/test-suite/php/using1_runme.php new file mode 100644 index 0000000..51841bc --- /dev/null +++ b/Examples/test-suite/php/using1_runme.php @@ -0,0 +1,9 @@ +<?php + +require "tests.php"; +require "using1.php"; +if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); +if (! 3==spam(3)) die("spam function not working right\n"); + +check::done(); +?> diff --git a/Examples/test-suite/php/using2_runme.php b/Examples/test-suite/php/using2_runme.php new file mode 100644 index 0000000..391a98f --- /dev/null +++ b/Examples/test-suite/php/using2_runme.php @@ -0,0 +1,9 @@ +<?php + +require "tests.php"; +require "using2.php"; +if (! class_exists("_fooimpl")) die("_fooimpl class not found\n"); +if (! 3==spam(3)) die("spam function not working right\n"); + +check::done(); +?> diff --git a/Examples/test-suite/php/valuewrapper_base_runme.php b/Examples/test-suite/php/valuewrapper_base_runme.php new file mode 100644 index 0000000..6a1abdb --- /dev/null +++ b/Examples/test-suite/php/valuewrapper_base_runme.php @@ -0,0 +1,13 @@ +<?php + +require "tests.php"; +require "valuewrapper_base.php"; + +check::classes(array("valuewrapper_base","Base","Interface_BP")); +check::functions("make_interface_bp"); + +$ibp=valuewrapper_base::make_interface_bp(); +check::classname("interface_bp",$ibp); + +check::done(); +?> |
