--- /dev/null
+--TEST--
+SPL: FastArray: Trying to instantiate passing object to constructor parameter
+--FILE--
+<?php
+
+$b = new stdClass;
+
+$a = new SplFastArray($b);
+
+?>
+--EXPECTF--
+Warning: SplFastArray::__construct() expects parameter 1 to be long, object given in %s on line %d
--- /dev/null
+--TEST--
+SPL: FastArray: Assigning objects
+--FILE--
+<?php
+
+$b = 10000;
+$a = new SplFastArray($b);
+
+try {
+ for ($i = 0; $i < 100; $i++) {
+ $a[] = new stdClass;
+ }
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+print "ok\n";
+
+?>
+--EXPECT--
+Index invalid or out of range
+ok
--- /dev/null
+--TEST--
+SPL: FastArray: Assigning the itself object
+--FILE--
+<?php
+
+$b = 10;
+$a = new SplFastArray($b);
+
+try {
+ $a[1] = $a;
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+foreach ($a as $c) {
+ if ($c) {
+ echo $c->getSize(), "\n";
+ }
+}
+
+print "ok\n";
+
+?>
+--EXPECT--
+10
+ok
--- /dev/null
+--TEST--
+SPL: FastArray: Assigning the itself object testing the reference
+--FILE--
+<?php
+
+$b = 3;
+$a = new SplFastArray($b);
+
+$a[0] = 1;
+$a[1] = 2;
+$a[2] = $a;
+
+$a[2][0] = 3;
+
+foreach ($a as $x) {
+ if (is_object($x)) {
+ var_dump($x[0]);
+ } else {
+ var_dump($x);
+ }
+}
+
+var_dump($a->getSize());
+
+?>
+--EXPECT--
+int(3)
+int(2)
+int(3)
+int(3)
--- /dev/null
+--TEST--
+SPL: FastArray: Trying to instantiate passing string to construtor parameter
+--FILE--
+<?php
+
+$a = new SplFastArray('FOO');
+
+?>
+--EXPECTF--
+Warning: SplFastArray::__construct() expects parameter 1 to be long, string given in %s on line %d
--- /dev/null
+--TEST--
+SPL: FastArray: Setting size to 0
+--FILE--
+<?php
+
+$a = new SplFastArray(1);
+
+$a[0] = 1;
+
+$a->setSize(0);
+
+print "ok\n";
+
+?>
+--EXPECT--
+ok
--- /dev/null
+--TEST--
+SPL: FastArray: Testing setSize() with NULL
+--FILE--
+<?php
+
+$a = new SplFastArray(100);
+
+$a->setSize(NULL);
+
+print "ok\n";
+
+?>
+--EXPECT--
+ok
--- /dev/null
+--TEST--
+SPL: FastArray: Assigning the object to another variable using []
+--FILE--
+<?php
+
+$a = new SplFastArray(100);
+
+try {
+ $b = &$a[];
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+print "ok\n";
+
+?>
+--EXPECT--
+Index invalid or out of range
+ok
--- /dev/null
+--TEST--
+SPL: FastArray: Passing the object using [] as parameter
+--FILE--
+<?php
+
+$a = new SplFastArray(100);
+
+
+function test(SplFastArray &$arr) {
+ print "ok\n";
+}
+
+try {
+ test($a[]);
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Index invalid or out of range
--- /dev/null
+--TEST--
+SPL: FastArray: Trying to access inexistent item
+--FILE--
+<?php
+
+try {
+ $a = new SplFastArray(NULL);
+ echo $a[0]++;
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Index invalid or out of range