| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Test comparison operations that involve one or two constant Smis. | 28 // Test comparison operations that involve one or two constant smis. |
| 29 | 29 |
| 30 | 30 function test() { |
| 31 function foo() { | |
| 32 var i = 5; | 31 var i = 5; |
| 33 var j = 3; | 32 var j = 3; |
| 34 | 33 |
| 35 assertTrue( j < i ); | 34 assertTrue( j < i ); |
| 36 i = 5; j = 3; | 35 i = 5; j = 3; |
| 37 assertTrue( j <= i ); | 36 assertTrue( j <= i ); |
| 38 i = 5; j = 3; | 37 i = 5; j = 3; |
| 39 assertTrue( i > j ); | 38 assertTrue( i > j ); |
| 40 i = 5; j = 3; | 39 i = 5; j = 3; |
| 41 assertTrue( i >= j ); | 40 assertTrue( i >= j ); |
| 42 i = 5; j = 3; | 41 i = 5; j = 3; |
| 43 assertTrue( i != j ); | 42 assertTrue( i != j ); |
| 44 i = 5; j = 3; | 43 i = 5; j = 3; |
| 45 assertTrue( i == i ); | 44 assertTrue( i == i ); |
| 46 i = 5; j = 3; | 45 i = 5; j = 3; |
| 47 assertFalse( i < j ); | 46 assertFalse( i < j ); |
| 48 i = 5; j = 3; | 47 i = 5; j = 3; |
| 49 assertFalse( i <= j ); | 48 assertFalse( i <= j ); |
| 50 i = 5; j = 3; | 49 i = 5; j = 3; |
| 51 assertFalse( j > i ); | 50 assertFalse( j > i ); |
| 52 i = 5; j = 3; | 51 i = 5; j = 3; |
| 53 assertFalse(j >= i ); | 52 assertFalse(j >= i ); |
| 54 i = 5; j = 3; | 53 i = 5; j = 3; |
| 55 assertFalse( j == i); | 54 assertFalse( j == i); |
| 56 i = 5; j = 3; | 55 i = 5; j = 3; |
| 57 assertFalse( i != i); | 56 assertFalse( i != i); |
| 58 | 57 |
| 59 i = 10 * 10; | 58 i = 10 * 10; |
| 60 while ( i < 107 ) { | 59 while ( i < 107 ) { |
| 61 ++i; | 60 ++i; |
| 62 } | 61 } |
| 63 j = 21; | 62 j = 21; |
| 64 | 63 |
| 65 | |
| 66 assertTrue( j < i ); | 64 assertTrue( j < i ); |
| 67 j = 21; | 65 j = 21; |
| 68 assertTrue( j <= i ); | 66 assertTrue( j <= i ); |
| 69 j = 21; | 67 j = 21; |
| 70 assertTrue( i > j ); | 68 assertTrue( i > j ); |
| 71 j = 21; | 69 j = 21; |
| 72 assertTrue( i >= j ); | 70 assertTrue( i >= j ); |
| 73 j = 21; | 71 j = 21; |
| 74 assertTrue( i != j ); | 72 assertTrue( i != j ); |
| 75 j = 21; | 73 j = 21; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 default: | 107 default: |
| 110 i = 2; | 108 i = 2; |
| 111 case 7: | 109 case 7: |
| 112 j = 17; | 110 j = 17; |
| 113 break; | 111 break; |
| 114 case 9: | 112 case 9: |
| 115 j = 19; | 113 j = 19; |
| 116 assertUnreachable(); | 114 assertUnreachable(); |
| 117 break; | 115 break; |
| 118 } | 116 } |
| 119 assertEquals(17, j, "switch with constant value"); | 117 assertEquals(17, j, "switch with constant value"); |
| 120 } | 118 } |
| 121 | 119 |
| 122 foo(); | 120 test(); |
| 123 | 121 |
| OLD | NEW |