| 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 x = ""; | 50 x = ""; |
| 51 assertEquals(Math.atan2(1, 2), Math.atan2(v, w)); | 51 assertEquals(Math.atan2(1, 2), Math.atan2(v, w)); |
| 52 // JSC says fiskhest. | 52 // JSC says fiskhest. |
| 53 assertEquals("hestfisk", x, "atan2"); | 53 assertEquals("hestfisk", x, "atan2"); |
| 54 | 54 |
| 55 x = ""; | 55 x = ""; |
| 56 assertEquals(1, Math.pow(v, w)); | 56 assertEquals(1, Math.pow(v, w)); |
| 57 assertEquals("hestfisk", x, "pow"); | 57 assertEquals("hestfisk", x, "pow"); |
| 58 | 58 |
| 59 x = ""; |
| 60 var a = {valueOf: function() { x += "hest"; return 1/0; }}; |
| 61 var b = {valueOf: function() { x += "fisk"; return 1}}; |
| 62 assertEquals(1/0, Math.hypot(a, b)); |
| 63 assertEquals("hestfisk", x, "hypot"); |
| 64 |
| 65 |
| 59 var year = { valueOf: function() { x += 1; return 2007; } }; | 66 var year = { valueOf: function() { x += 1; return 2007; } }; |
| 60 var month = { valueOf: function() { x += 2; return 2; } }; | 67 var month = { valueOf: function() { x += 2; return 2; } }; |
| 61 var date = { valueOf: function() { x += 3; return 4; } }; | 68 var date = { valueOf: function() { x += 3; return 4; } }; |
| 62 var hours = { valueOf: function() { x += 4; return 13; } }; | 69 var hours = { valueOf: function() { x += 4; return 13; } }; |
| 63 var minutes = { valueOf: function() { x += 5; return 50; } }; | 70 var minutes = { valueOf: function() { x += 5; return 50; } }; |
| 64 var seconds = { valueOf: function() { x += 6; return 0; } }; | 71 var seconds = { valueOf: function() { x += 6; return 0; } }; |
| 65 var ms = { valueOf: function() { x += 7; return 999; } }; | 72 var ms = { valueOf: function() { x += 7; return 999; } }; |
| 66 | 73 |
| 67 x = ""; | 74 x = ""; |
| 68 new Date(year, month, date, hours, minutes, seconds, ms); | 75 new Date(year, month, date, hours, minutes, seconds, ms); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 assertEquals("fisk", x, "Compare objects undefined > b valueOf order"); | 213 assertEquals("fisk", x, "Compare objects undefined > b valueOf order"); |
| 207 } | 214 } |
| 208 | 215 |
| 209 // Call inside loop to test optimization and possible caching. | 216 // Call inside loop to test optimization and possible caching. |
| 210 for (i = 0; i < 3; ++i) { | 217 for (i = 0; i < 3; ++i) { |
| 211 identical_object_comparison(); | 218 identical_object_comparison(); |
| 212 } | 219 } |
| 213 | 220 |
| 214 | 221 |
| 215 print("ok"); | 222 print("ok"); |
| OLD | NEW |