tony2001 Sun Jul 13 19:47:52 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests fixedarray_021.phpt
Modified files: /php-src/ext/spl/tests fixedarray_010.phpt Log: improve code coverage http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_010.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/spl/tests/fixedarray_010.phpt diff -u php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.3 php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.4 --- php-src/ext/spl/tests/fixedarray_010.phpt:1.1.2.3 Sun Jun 22 16:25:02 2008 +++ php-src/ext/spl/tests/fixedarray_010.phpt Sun Jul 13 19:47:52 2008 @@ -12,8 +12,39 @@ $a->setSize(3); $a->setSize(0); +$a = new SplFixedArray(0); +$a->setSize(0); +var_dump($a->getSize()); + +$a = new SplFixedArray(10); +$a->setSize(10); +var_dump($a->getSize()); + +$a = new SplFixedArray(1); +$a->setSize(5); +var_dump($a->getSize()); + +$a = new SplFixedArray(20); +$a->setSize(3); +var_dump($a->getSize()); + +$a = new SplFixedArray(3); + +$a[0] = "test"; +$a[1] = array(1,2,"blah"); +$a[2] = 1; +$a[0] = "test"; + +$a->setSize(0); +var_dump($a->getSize()); + print "ok\n"; ?> --EXPECT-- +int(0) +int(10) +int(5) +int(3) +int(0) ok http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fixedarray_021.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/fixedarray_021.phpt +++ php-src/ext/spl/tests/fixedarray_021.phpt --TEST-- SPL: FixedArray: misc small tests --FILE-- <?php /* empty count */ $a = new SplFixedArray(); var_dump(count($a)); var_dump($a->count()); /* negative init value */ try { $b = new SplFixedArray(-10); } catch (Exception $e) { var_dump($e->getMessage()); } /* resize and negative value */ $b = new SplFixedArray(); try { $b->setSize(-5); } catch (Exception $e) { var_dump($e->getMessage()); } /* calling __construct() twice */ $c = new SplFixedArray(0); var_dump($c->__construct()); /* fromArray() from empty array */ $d = new SplFixedArray(); $d->fromArray(array()); var_dump(count($a)); var_dump($a->count()); var_dump($a); /* foreach by ref */ $e = new SplFixedArray(10); $e[0] = 1; $e[1] = 5; $e[2] = 10; try { foreach ($e as $k=>&$v) { var_dump($v); } } catch (Exception $e) { var_dump($e->getMessage()); } ?> ==DONE== --EXPECTF-- int(0) int(0) unicode(35) "array size cannot be less than zero" unicode(35) "array size cannot be less than zero" NULL int(0) int(0) object(SplFixedArray)#$d (0) { } unicode(52) "An iterator cannot be used with foreach by reference" ==DONE== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php