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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 } | 232 } |
233 | 233 |
234 function checkArity(args, arity, name) { | 234 function checkArity(args, arity, name) { |
235 if (args.length < arity) { | 235 if (args.length < arity) { |
236 fail(PrettyPrint(arity), args.length, | 236 fail(PrettyPrint(arity), args.length, |
237 name + " requires " + arity + " or more arguments"); | 237 name + " requires " + arity + " or more arguments"); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 assertSame = function assertSame(expected, found, name_opt) { | 241 assertSame = function assertSame(expected, found, name_opt) { |
242 checkArity(arguments, 2, "assertSame"); | 242 // checkArity(arguments, 2, "assertSame"); |
Michael Starzinger
2014/11/14 10:21:22
So maybe instead of commenting it out, we should r
| |
243 | 243 |
244 // TODO(mstarzinger): We should think about using Harmony's egal operator | 244 // TODO(mstarzinger): We should think about using Harmony's egal operator |
245 // or the function equivalent Object.is() here. | 245 // or the function equivalent Object.is() here. |
246 if (found === expected) { | 246 if (found === expected) { |
247 if (expected !== 0 || (1 / expected) == (1 / found)) return; | 247 if (expected !== 0 || (1 / expected) == (1 / found)) return; |
248 } else if ((expected !== expected) && (found !== found)) { | 248 } else if ((expected !== expected) && (found !== found)) { |
249 return; | 249 return; |
250 } | 250 } |
251 fail(PrettyPrint(expected), found, name_opt); | 251 fail(PrettyPrint(expected), found, name_opt); |
252 }; | 252 }; |
253 | 253 |
254 | 254 |
255 assertEquals = function assertEquals(expected, found, name_opt) { | 255 assertEquals = function assertEquals(expected, found, name_opt) { |
256 checkArity(arguments, 2, "assertEquals"); | 256 // checkArity(arguments, 2, "assertEquals"); |
257 | 257 |
258 if (!deepEquals(found, expected)) { | 258 if (!deepEquals(found, expected)) { |
259 fail(PrettyPrint(expected), found, name_opt); | 259 fail(PrettyPrint(expected), found, name_opt); |
260 } | 260 } |
261 }; | 261 }; |
262 | 262 |
263 | 263 |
264 assertEqualsDelta = | 264 assertEqualsDelta = |
265 function assertEqualsDelta(expected, found, delta, name_opt) { | 265 function assertEqualsDelta(expected, found, delta, name_opt) { |
266 assertTrue(Math.abs(expected - found) <= delta, name_opt); | 266 assertTrue(Math.abs(expected - found) <= delta, name_opt); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 if (sync_opt === undefined) sync_opt = ""; | 399 if (sync_opt === undefined) sync_opt = ""; |
400 assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); | 400 assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); |
401 } | 401 } |
402 | 402 |
403 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { | 403 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { |
404 if (sync_opt === undefined) sync_opt = ""; | 404 if (sync_opt === undefined) sync_opt = ""; |
405 assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); | 405 assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); |
406 } | 406 } |
407 | 407 |
408 })(); | 408 })(); |
OLD | NEW |