~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to tests/lang/operators/operator_identical_variation.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test === operator : max int 32bit range
 
3
--SKIPIF--
 
4
<?php
 
5
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
 
6
?>
 
7
--FILE--
 
8
<?php
 
9
 
 
10
define("MAX_64Bit", 9223372036854775807);
 
11
define("MAX_32Bit", 2147483647);
 
12
define("MIN_64Bit", -9223372036854775807 - 1);
 
13
define("MIN_32Bit", -2147483647 - 1);
 
14
 
 
15
$validIdentical = array (
 
16
MAX_32Bit, array(MAX_32Bit),
 
17
MIN_32Bit, array(MIN_32Bit),
 
18
MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
 
19
MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
 
20
);
 
21
 
 
22
$invalidIdentical = array (
 
23
MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
 
24
MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
 
25
);
 
26
 
 
27
 
 
28
$failed = false;
 
29
// test for valid values
 
30
for ($i = 0; $i < count($validIdentical); $i +=2) {
 
31
   $typeToTestVal = $validIdentical[$i];
 
32
   $compares = $validIdentical[$i + 1];
 
33
   foreach($compares as $compareVal) {
 
34
      if ($typeToTestVal === $compareVal) {
 
35
         // do nothing
 
36
      }
 
37
      else {
 
38
         echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
 
39
         $failed = true;
 
40
      }
 
41
   }
 
42
}
 
43
// test for invalid values
 
44
for ($i = 0; $i < count($invalidIdentical); $i +=2) {
 
45
   $typeToTestVal = $invalidIdentical[$i];
 
46
   $compares = $invalidIdentical[$i + 1];
 
47
   foreach($compares as $compareVal) {
 
48
      if ($typeToTestVal === $compareVal) {
 
49
         echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
 
50
         $failed = true;
 
51
      }
 
52
   }
 
53
}
 
54
 
 
55
if ($failed == false) {
 
56
   echo "Test Passed\n";
 
57
}
 
58
   
 
59
?>
 
60
===DONE===
 
61
--EXPECT--
 
62
Test Passed
 
63
===DONE===
 
 
b'\\ No newline at end of file'