Skip to content

Commit df6ec80

Browse files
committed
expect runtime exponent to reflect nesting
1 parent 298e473 commit df6ec80

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/javascript/generate-data-spec.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ describe("Generating data...", function() {
3636
var resultOfExpSlow = generateData.measureRunTime(measureMeExponetiallySlow, [max, dataHolder], runtimeHolder);
3737
// console.log(JSON.stringify(dataHolder));
3838

39-
/* If it was unmeasureably fast, try again with 10 times more data */
39+
/* If it was unmeasureably fast, try again with twice as much data */
4040
if (runtimeHolder.runtime === 0) {
41-
max = max * 10;
41+
max = max * 2;
4242
resultOfExpSlow = generateData.measureRunTime(measureMeExponetiallySlow, [max, dataHolder], runtimeHolder);
4343
}
4444
expect(resultOfExpSlow.length > 0).toBe(true);
@@ -175,7 +175,10 @@ describe("Generating data...", function() {
175175
var exponentialTime = linearFactor * linearFactor;
176176
expect(firstFactor).toBeLessThan(exponentialTime);
177177
expect(secondFactor).toBeLessThan(exponentialTime);
178+
var exponent = Math.log2(runtime2/runtime1);
179+
console.log(exponent);
180+
expect(Math.round(exponent)).toEqual(2);
178181
});
179182

180183

181-
});
184+
});

0 commit comments

Comments
 (0)