| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 assertEquals(max, MaxLE(x, y), "MaxLE - primitive"); | 52 assertEquals(max, MaxLE(x, y), "MaxLE - primitive"); |
| 53 assertEquals(max, MaxGE(x, y), "MaxGE - primitive"); | 53 assertEquals(max, MaxGE(x, y), "MaxGE - primitive"); |
| 54 assertEquals(max, MaxGT(x, y), "MaxGT - primitive"); | 54 assertEquals(max, MaxGT(x, y), "MaxGT - primitive"); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TestPrimitive(1, 0, 1); | 57 TestPrimitive(1, 0, 1); |
| 58 TestPrimitive(1, 1, 0); | 58 TestPrimitive(1, 1, 0); |
| 59 TestPrimitive(4, 3, 4); | 59 TestPrimitive(4, 3, 4); |
| 60 TestPrimitive(4, 4, 3); | 60 TestPrimitive(4, 4, 3); |
| 61 TestPrimitive(0, -1, 0); | 61 TestPrimitive(0, -1, 0); |
| 62 TestPrimitive(0, 0, -1) | 62 TestPrimitive(0, 0, -1); |
| 63 TestPrimitive(-2, -2, -3); | 63 TestPrimitive(-2, -2, -3); |
| 64 TestPrimitive(-2, -3, -2); | 64 TestPrimitive(-2, -3, -2); |
| 65 | 65 |
| 66 TestPrimitive(1, 0.1, 1); | 66 TestPrimitive(1, 0.1, 1); |
| 67 TestPrimitive(1, 1, 0.1); | 67 TestPrimitive(1, 1, 0.1); |
| 68 TestPrimitive(4, 3.1, 4); | 68 TestPrimitive(4, 3.1, 4); |
| 69 TestPrimitive(4, 4, 3.1); | 69 TestPrimitive(4, 4, 3.1); |
| 70 TestPrimitive(0, -1.1, 0); | 70 TestPrimitive(0, -1.1, 0); |
| 71 TestPrimitive(0, 0, -1.1) | 71 TestPrimitive(0, 0, -1.1); |
| 72 TestPrimitive(-2, -2, -3.1); | 72 TestPrimitive(-2, -2, -3.1); |
| 73 TestPrimitive(-2, -3.1, -2); | 73 TestPrimitive(-2, -3.1, -2); |
| 74 | 74 |
| 75 | 75 |
| 76 // Test non-primitive values and watch for valueOf call order. | 76 // Test non-primitive values and watch for valueOf call order. |
| 77 function TestNonPrimitive(order, f) { | 77 function TestNonPrimitive(order, f) { |
| 78 var result = ""; | 78 var result = ""; |
| 79 var x = { valueOf: function() { result += "x"; } }; | 79 var x = { valueOf: function() { result += "x"; } }; |
| 80 var y = { valueOf: function() { result += "y"; } }; | 80 var y = { valueOf: function() { result += "y"; } }; |
| 81 f(x, y); | 81 f(x, y); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 99 function CmpNullValue(x) { return x == null; } | 99 function CmpNullValue(x) { return x == null; } |
| 100 assertEquals(false, CmpNullValue(42)); | 100 assertEquals(false, CmpNullValue(42)); |
| 101 | 101 |
| 102 function CmpNullTest(x) { if (x == null) return 42; return 0; } | 102 function CmpNullTest(x) { if (x == null) return 42; return 0; } |
| 103 assertEquals(42, CmpNullTest(null)); | 103 assertEquals(42, CmpNullTest(null)); |
| 104 | 104 |
| 105 var g1 = 0; | 105 var g1 = 0; |
| 106 function CmpNullEffect() { (g1 = 42) == null; } | 106 function CmpNullEffect() { (g1 = 42) == null; } |
| 107 CmpNullEffect(); | 107 CmpNullEffect(); |
| 108 assertEquals(42, g1); | 108 assertEquals(42, g1); |
| OLD | NEW |