| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 start = "Fail" + "ure (" + name_opt + "): "; | 46 start = "Fail" + "ure (" + name_opt + "): "; |
| 47 } else { | 47 } else { |
| 48 start = "Fail" + "ure:"; | 48 start = "Fail" + "ure:"; |
| 49 } | 49 } |
| 50 throw new MjsUnitAssertionError(start + " expected <" + expected + "> found <"
+ found + ">"); | 50 throw new MjsUnitAssertionError(start + " expected <" + expected + "> found <"
+ found + ">"); |
| 51 } | 51 } |
| 52 | 52 |
| 53 | 53 |
| 54 function deepEquals(a, b) { | 54 function deepEquals(a, b) { |
| 55 if (a == b) return true; | 55 if (a == b) return true; |
| 56 if (typeof a == "number" && typeof b == "number" && isNaN(a) && isNaN(b)) { |
| 57 return true; |
| 58 } |
| 56 if ((typeof a) !== 'object' || (typeof b) !== 'object' || | 59 if ((typeof a) !== 'object' || (typeof b) !== 'object' || |
| 57 (a === null) || (b === null)) | 60 (a === null) || (b === null)) |
| 58 return false; | 61 return false; |
| 59 if (a.constructor === Array) { | 62 if (a.constructor === Array) { |
| 60 if (b.constructor !== Array) | 63 if (b.constructor !== Array) |
| 61 return false; | 64 return false; |
| 62 if (a.length != b.length) | 65 if (a.length != b.length) |
| 63 return false; | 66 return false; |
| 64 for (var i = 0; i < a.length; i++) { | 67 for (var i = 0; i < a.length; i++) { |
| 65 if (i in a) { | 68 if (i in a) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 159 |
| 157 | 160 |
| 158 function assertUnreachable(name_opt) { | 161 function assertUnreachable(name_opt) { |
| 159 // Fix this when we ditch the old test runner. | 162 // Fix this when we ditch the old test runner. |
| 160 var message = "Fail" + "ure: unreachable" | 163 var message = "Fail" + "ure: unreachable" |
| 161 if (name_opt) { | 164 if (name_opt) { |
| 162 message += " - " + name_opt; | 165 message += " - " + name_opt; |
| 163 } | 166 } |
| 164 throw new MjsUnitAssertionError(message); | 167 throw new MjsUnitAssertionError(message); |
| 165 } | 168 } |
| OLD | NEW |