| OLD | NEW |
| (Empty) |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | |
| 2 // Redistribution and use in source and binary forms, with or without | |
| 3 // modification, are permitted provided that the following conditions are | |
| 4 // met: | |
| 5 // | |
| 6 // * Redistributions of source code must retain the above copyright | |
| 7 // notice, this list of conditions and the following disclaimer. | |
| 8 // * Redistributions in binary form must reproduce the above | |
| 9 // copyright notice, this list of conditions and the following | |
| 10 // disclaimer in the documentation and/or other materials provided | |
| 11 // with the distribution. | |
| 12 // * Neither the name of Google Inc. nor the names of its | |
| 13 // contributors may be used to endorse or promote products derived | |
| 14 // from this software without specific prior written permission. | |
| 15 // | |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 27 | |
| 28 // Test comparison operations that involve one or two constant smis. | |
| 29 | |
| 30 function test() { | |
| 31 var i = 5; | |
| 32 var j = 3; | |
| 33 | |
| 34 assertTrue( j < i ); | |
| 35 i = 5; j = 3; | |
| 36 assertTrue( j <= i ); | |
| 37 i = 5; j = 3; | |
| 38 assertTrue( i > j ); | |
| 39 i = 5; j = 3; | |
| 40 assertTrue( i >= j ); | |
| 41 i = 5; j = 3; | |
| 42 assertTrue( i != j ); | |
| 43 i = 5; j = 3; | |
| 44 assertTrue( i == i ); | |
| 45 i = 5; j = 3; | |
| 46 assertFalse( i < j ); | |
| 47 i = 5; j = 3; | |
| 48 assertFalse( i <= j ); | |
| 49 i = 5; j = 3; | |
| 50 assertFalse( j > i ); | |
| 51 i = 5; j = 3; | |
| 52 assertFalse(j >= i ); | |
| 53 i = 5; j = 3; | |
| 54 assertFalse( j == i); | |
| 55 i = 5; j = 3; | |
| 56 assertFalse( i != i); | |
| 57 | |
| 58 i = 10 * 10; | |
| 59 while ( i < 107 ) { | |
| 60 ++i; | |
| 61 } | |
| 62 j = 21; | |
| 63 | |
| 64 assertTrue( j < i ); | |
| 65 j = 21; | |
| 66 assertTrue( j <= i ); | |
| 67 j = 21; | |
| 68 assertTrue( i > j ); | |
| 69 j = 21; | |
| 70 assertTrue( i >= j ); | |
| 71 j = 21; | |
| 72 assertTrue( i != j ); | |
| 73 j = 21; | |
| 74 assertTrue( i == i ); | |
| 75 j = 21; | |
| 76 assertFalse( i < j ); | |
| 77 j = 21; | |
| 78 assertFalse( i <= j ); | |
| 79 j = 21; | |
| 80 assertFalse( j > i ); | |
| 81 j = 21; | |
| 82 assertFalse(j >= i ); | |
| 83 j = 21; | |
| 84 assertFalse( j == i); | |
| 85 j = 21; | |
| 86 assertFalse( i != i); | |
| 87 j = 21; | |
| 88 assertTrue( j == j ); | |
| 89 j = 21; | |
| 90 assertFalse( j != j ); | |
| 91 | |
| 92 assertTrue( 100 > 99 ); | |
| 93 assertTrue( 101 >= 90 ); | |
| 94 assertTrue( 11111 > -234 ); | |
| 95 assertTrue( -888 <= -20 ); | |
| 96 | |
| 97 while ( 234 > 456 ) { | |
| 98 i = i + 1; | |
| 99 } | |
| 100 | |
| 101 switch(3) { | |
| 102 case 5: | |
| 103 assertUnreachable(); | |
| 104 break; | |
| 105 case 3: | |
| 106 j = 13; | |
| 107 default: | |
| 108 i = 2; | |
| 109 case 7: | |
| 110 j = 17; | |
| 111 break; | |
| 112 case 9: | |
| 113 j = 19; | |
| 114 assertUnreachable(); | |
| 115 break; | |
| 116 } | |
| 117 assertEquals(17, j, "switch with constant value"); | |
| 118 } | |
| 119 | |
| 120 test(); | |
| 121 | |
| OLD | NEW |