xref: /php-src/ext/spl/tests/dualiterator_001.phpt (revision f8d79582)
1--TEST--
2SPL: DualIterator
3--FILE--
4<?php
5
6function spl_examples_autoload($classname)
7{
8    include(__DIR__ . '/' . strtolower($classname) . '.inc');
9}
10
11spl_autoload_register('spl_examples_autoload');
12
13function test($a, $b, $identical = false)
14{
15    var_dump(DualIterator::compareIterators(
16                    new RecursiveArrayIterator($a),
17                    new RecursiveArrayIterator($b),
18                    $identical));
19}
20
21test(array(1,2,3), array(1,2,3));
22test(array(1,2,3), array(1,2));
23test(array(1,array(21,22),3), array(1,array(21,22),3));
24test(array(1,array(21,22),3), array(1,array(21,22,23),3));
25test(array(1,array(21,22),3), array(1,array(21,22,3)));
26test(array(1,array(21,22),3), array(1,array(21),array(22),3));
27test(array(1,2,3), array(1,"2",3), false);
28test(array(1,2,3), array(1,"2",3), true);
29test(array(1,array(21,22),3), array(1,array(21,"22"),3), false);
30test(array(1,array(21,22),3), array(1,array(21,"22"),3), true);
31
32?>
33--EXPECT--
34bool(true)
35bool(false)
36bool(true)
37bool(false)
38bool(false)
39bool(false)
40bool(true)
41bool(false)
42bool(true)
43bool(false)
44