| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 224       } | 224       } | 
| 225       return true; | 225       return true; | 
| 226     } | 226     } | 
| 227     if (objectClass == "String" || objectClass == "Number" || | 227     if (objectClass == "String" || objectClass == "Number" || | 
| 228       objectClass == "Boolean" || objectClass == "Date") { | 228       objectClass == "Boolean" || objectClass == "Date") { | 
| 229       if (a.valueOf() !== b.valueOf()) return false; | 229       if (a.valueOf() !== b.valueOf()) return false; | 
| 230     } | 230     } | 
| 231     return deepObjectEquals(a, b); | 231     return deepObjectEquals(a, b); | 
| 232   } | 232   } | 
| 233 | 233 | 
|  | 234   function checkArity(args, arity, name) { | 
|  | 235     if (args.length < arity) { | 
|  | 236       fail(PrettyPrint(arity), args.length, | 
|  | 237            name + " requires " + arity + " or more arguments"); | 
|  | 238     } | 
|  | 239   } | 
| 234 | 240 | 
| 235   assertSame = function assertSame(expected, found, name_opt) { | 241   assertSame = function assertSame(expected, found, name_opt) { | 
|  | 242     checkArity(arguments, 2, "assertSame"); | 
|  | 243 | 
| 236     // TODO(mstarzinger): We should think about using Harmony's egal operator | 244     // TODO(mstarzinger): We should think about using Harmony's egal operator | 
| 237     // or the function equivalent Object.is() here. | 245     // or the function equivalent Object.is() here. | 
| 238     if (found === expected) { | 246     if (found === expected) { | 
| 239       if (expected !== 0 || (1 / expected) == (1 / found)) return; | 247       if (expected !== 0 || (1 / expected) == (1 / found)) return; | 
| 240     } else if ((expected !== expected) && (found !== found)) { | 248     } else if ((expected !== expected) && (found !== found)) { | 
| 241       return; | 249       return; | 
| 242     } | 250     } | 
| 243     fail(PrettyPrint(expected), found, name_opt); | 251     fail(PrettyPrint(expected), found, name_opt); | 
| 244   }; | 252   }; | 
| 245 | 253 | 
| 246 | 254 | 
| 247   assertEquals = function assertEquals(expected, found, name_opt) { | 255   assertEquals = function assertEquals(expected, found, name_opt) { | 
|  | 256     checkArity(arguments, 2, "assertEquals"); | 
|  | 257 | 
| 248     if (!deepEquals(found, expected)) { | 258     if (!deepEquals(found, expected)) { | 
| 249       fail(PrettyPrint(expected), found, name_opt); | 259       fail(PrettyPrint(expected), found, name_opt); | 
| 250     } | 260     } | 
| 251   }; | 261   }; | 
| 252 | 262 | 
| 253 | 263 | 
| 254   assertEqualsDelta = | 264   assertEqualsDelta = | 
| 255       function assertEqualsDelta(expected, found, delta, name_opt) { | 265       function assertEqualsDelta(expected, found, delta, name_opt) { | 
| 256     assertTrue(Math.abs(expected - found) <= delta, name_opt); | 266     assertTrue(Math.abs(expected - found) <= delta, name_opt); | 
| 257   }; | 267   }; | 
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390     if (sync_opt === undefined) sync_opt = ""; | 400     if (sync_opt === undefined) sync_opt = ""; | 
| 391     assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); | 401     assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); | 
| 392   } | 402   } | 
| 393 | 403 | 
| 394   assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 404   assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 
| 395     if (sync_opt === undefined) sync_opt = ""; | 405     if (sync_opt === undefined) sync_opt = ""; | 
| 396     assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); | 406     assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); | 
| 397   } | 407   } | 
| 398 | 408 | 
| 399 })(); | 409 })(); | 
| OLD | NEW | 
|---|