Skip to content

Commit

Permalink
Re-format due to prettier update
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Jul 12, 2018
1 parent d989b1c commit c3a6adc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions example/binary-trees/arbitraries/FullBinaryTreeArbitrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ export const fullBinaryTree = (maxDepth: number): fc.Arbitrary<Tree<number>> =>
});
}
const subTree = fullBinaryTree(maxDepth - 1);
return fc.boolean().chain((hasChildren: boolean): fc.Arbitrary<Tree<number>> => {
if (hasChildren) {
return fc.boolean().chain(
(hasChildren: boolean): fc.Arbitrary<Tree<number>> => {
if (hasChildren) {
return fc.record({
value: valueArbitrary,
left: subTree,
right: subTree
});
}
return fc.record({
value: valueArbitrary,
left: subTree,
right: subTree
left: fc.constant(null),
right: fc.constant(null)
});
}
return fc.record({
value: valueArbitrary,
left: fc.constant(null),
right: fc.constant(null)
});
});
);
};
2 changes: 1 addition & 1 deletion src/check/arbitrary/StringArbitrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function base64String(minLength: number, maxLength: number): Arbitrary<string>;
function base64String(aLength?: number, bLength?: number): Arbitrary<string> {
const minLength = aLength != null && bLength != null ? aLength : 0;
const maxLength = bLength == null ? (aLength == null ? 16 : aLength) : bLength;
return Base64StringArbitrary(minLength + 3 - (minLength + 3) % 4, maxLength - maxLength % 4); // base64 length is always a multiple of 4
return Base64StringArbitrary(minLength + 3 - ((minLength + 3) % 4), maxLength - (maxLength % 4)); // base64 length is always a multiple of 4
}

export { stringOf, string, asciiString, string16bits, unicodeString, fullUnicodeString, hexaString, base64String };
2 changes: 1 addition & 1 deletion src/check/runner/Sampler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function statistics<Ts>(
}
const data = ObjectEntries(recorded)
.sort((a, b) => b[1] - a[1])
.map(i => [i[0], `${(i[1] * 100.0 / qParams.numRuns).toFixed(2)}%`]);
.map(i => [i[0], `${((i[1] * 100.0) / qParams.numRuns).toFixed(2)}%`]);
const longestName = data.map(i => i[0].length).reduce((p, c) => Math.max(p, c), 0);
const longestPercent = data.map(i => i[1].length).reduce((p, c) => Math.max(p, c), 0);
for (const item of data) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/check/runner/Sampler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Sampler', () => {
});
});
describe('statistics', () => {
const customGen = (m: number = 7) => stubArb.forward().map(v => (v % m + m) % m);
const customGen = (m: number = 7) => stubArb.forward().map(v => ((v % m) + m) % m);
const reLabel = /^(.*[^.])\.+\d+\.\d+%$/;
const rePercent = /(\d+\.\d+)%$/;
it('Should always produce for non null number of runs', () =>
Expand Down

0 comments on commit c3a6adc

Please sign in to comment.