add bitset operations and tests
[hiphop-php.git] / hphp / test / slow / equals_same_vs_container_with_nan.php
blob1836ceff3fe284be7b19ea097ab1d0aefaaeb0d7
1 <?hh
3 function compare($type, $c, $d) {
4 echo "--- $type ----\n";
5 var_dump($c === $c);
6 var_dump($c == $c);
7 var_dump($c === $d);
8 var_dump($c == $d);
11 function test_veclike($name, $c, $d) {
12 // we take partly filled containers as an arguments and mutate them before
13 // passing them to compare, so that interning and hhbbc can't make them be
14 // backed by the same underlying storage; if that happened the assumptions
15 // of this test would be violated
16 $c[] = NAN;
17 $d[] = NAN;
18 compare($name, $c, $d);
21 function test_dictlike($name, $c, $d) {
22 // we take partly filled containers as an arguments and mutate them before
23 // passing them to compare, so that interning and hhbbc can't make them be
24 // backed by the same underlying storage; if that happened the assumptions
25 // of this test would be violated
26 $c['b'] = NAN;
27 $d['b'] = NAN;
28 compare($name, $c, $d);
31 function test() {
32 test_veclike('Packed Array', [1], [1]);
33 test_dictlike('Mixed Array', ['a' => 1], ['a' => 1]);
35 test_veclike('Vec', vec[1], vec[1]);
36 test_dictlike('Dict', dict['a' => 1], dict['a' => 1]);
38 test_veclike('Vector', Vector {1}, Vector {1});
39 test_dictlike('Map', Map {'a' => 1}, Map {'a' => 1});
42 test();