| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 function deepEquals(a, b) { | 73 function deepEquals(a, b) { |
| 74 if (a == b) return true; | 74 if (a == b) return true; |
| 75 if (typeof a == "number" && typeof b == "number" && isNaN(a) && isNaN(b)) { | 75 if (typeof a == "number" && typeof b == "number" && isNaN(a) && isNaN(b)) { |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 if (a.constructor === RegExp || b.constructor === RegExp) { |
| 79 return (a.constructor === b.constructor) && (a.toString === b.toString); |
| 80 } |
| 78 if ((typeof a) !== 'object' || (typeof b) !== 'object' || | 81 if ((typeof a) !== 'object' || (typeof b) !== 'object' || |
| 79 (a === null) || (b === null)) | 82 (a === null) || (b === null)) |
| 80 return false; | 83 return false; |
| 81 if (a.constructor === Array) { | 84 if (a.constructor === Array) { |
| 82 if (b.constructor !== Array) | 85 if (b.constructor !== Array) |
| 83 return false; | 86 return false; |
| 84 if (a.length != b.length) | 87 if (a.length != b.length) |
| 85 return false; | 88 return false; |
| 86 for (var i = 0; i < a.length; i++) { | 89 for (var i = 0; i < a.length; i++) { |
| 87 if (i in a) { | 90 if (i in a) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 194 |
| 192 | 195 |
| 193 function assertUnreachable(name_opt) { | 196 function assertUnreachable(name_opt) { |
| 194 // Fix this when we ditch the old test runner. | 197 // Fix this when we ditch the old test runner. |
| 195 var message = "Fail" + "ure: unreachable" | 198 var message = "Fail" + "ure: unreachable" |
| 196 if (name_opt) { | 199 if (name_opt) { |
| 197 message += " - " + name_opt; | 200 message += " - " + name_opt; |
| 198 } | 201 } |
| 199 throw new MjsUnitAssertionError(message); | 202 throw new MjsUnitAssertionError(message); |
| 200 } | 203 } |
| OLD | NEW |