File: perf.test.js

package info (click to toggle)
should.js 13.2.3~dfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 660 kB
  • sloc: javascript: 5,402; makefile: 11
file content (16 lines) | stat: -rw-r--r-- 452 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function mockComplexObject(prefix, depth, width) {
  if (depth <= 0) {
    return "value-" + prefix;
  }
  var obj = {};
  for (var i = 0; i < width; i++) {
    obj[prefix + depth + "_" + i] = mockComplexObject(prefix, depth - 1, width);
  }
  return obj;
}
var a = mockComplexObject("a", 8, 4);
var b = mockComplexObject("b", 8, 4);

it("should optimize not.equal for complex objects", function() {
  a.should.be.not.equal(b); // It takes a while
});