Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dubzzz/fast-check
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.1
Choose a base ref
...
head repository: dubzzz/fast-check
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.0
Choose a head ref
  • 16 commits
  • 37 files changed
  • 2 contributors

Commits on Oct 16, 2020

  1. ⬆️ Bump rollup from 2.30.0 to 2.31.0 (#1066)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.30.0 to 2.31.0.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.30.0...v2.31.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 16, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    veprbl Dmitry Kalinkin
    Copy the full SHA
    03f5b4b View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    5a565ec View commit details

Commits on Oct 18, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    51f5795 View commit details

Commits on Oct 19, 2020

  1. ⬆️ Bump rollup in /test/esm/rollup-with-require (#1073)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.29.0 to 2.32.0.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.29.0...v2.32.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    83e803e View commit details
  2. ⬆️ Bump rollup in /test/esm/rollup-with-import (#1072)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.29.0 to 2.32.0.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.29.0...v2.32.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    24f2821 View commit details
  3. ⬆️ Bump @types/node from 14.11.8 to 14.11.10 (#1071)

    Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.11.8 to 14.11.10.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    98a4444 View commit details
  4. ⬆️ Bump rollup from 2.31.0 to 2.32.0 (#1070)

    Bumps [rollup](https://github.com/rollup/rollup) from 2.31.0 to 2.32.0.
    - [Release notes](https://github.com/rollup/rollup/releases)
    - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
    - [Commits](rollup/rollup@v2.31.0...v2.32.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    veprbl Dmitry Kalinkin
    Copy the full SHA
    606b9ff View commit details
  5. ⬆️ Bump eslint-config-prettier from 6.12.0 to 6.13.0 (#1069)

    Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.12.0 to 6.13.0.
    - [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
    - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
    - [Commits](prettier/eslint-config-prettier@v6.12.0...v6.13.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 19, 2020
    Copy the full SHA
    09169a4 View commit details
  6. Copy the full SHA
    8e767cc View commit details
  7. Copy the full SHA
    cb38477 View commit details

Commits on Oct 20, 2020

  1. ⬆️ Bump jest from 26.5.3 to 26.6.0 (#1077)

    Bumps [jest](https://github.com/facebook/jest) from 26.5.3 to 26.6.0.
    - [Release notes](https://github.com/facebook/jest/releases)
    - [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
    - [Commits](jestjs/jest@v26.5.3...v26.6.0)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 20, 2020
    Copy the full SHA
    28b0155 View commit details

Commits on Oct 21, 2020

  1. ⬆️ Bump @types/node from 14.11.10 to 14.14.0 (#1079)

    Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.11.10 to 14.14.0.
    - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
    - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 21, 2020
    Copy the full SHA
    89681cd View commit details
  2. Copy the full SHA
    107caef View commit details
  3. Copy the full SHA
    0cbb470 View commit details
  4. Update CHANGELOG.md

    dubzzz authored Oct 21, 2020
    Copy the full SHA
    08e1419 View commit details
  5. 2.6.0

    dubzzz committed Oct 21, 2020
    Copy the full SHA
    5567eca View commit details
Showing with 2,041 additions and 6,669 deletions.
  1. +14 −0 CHANGELOG.md
  2. +43 −0 codemods/unify-signatures/snippet-5.js
  3. +84 −0 codemods/unify-signatures/transform.cjs
  4. +94 −66 documentation/Arbitraries.md
  5. +1 −1 package.json
  6. +2 −2 src/check/arbitrary/ArrayArbitrary.ts
  7. +79 −5 src/check/arbitrary/BigIntArbitrary.ts
  8. +76 −8 src/check/arbitrary/FloatingPointArbitrary.ts
  9. +97 −11 src/check/arbitrary/IntegerArbitrary.ts
  10. +2 −2 src/check/arbitrary/LoremArbitrary.ts
  11. +4 −4 src/check/arbitrary/ObjectArbitrary.ts
  12. +4 −0 src/check/arbitrary/OptionArbitrary.ts
  13. +5 −5 src/check/arbitrary/SetArbitrary.ts
  14. +16 −16 src/check/arbitrary/StringArbitrary.ts
  15. +2 −2 src/check/arbitrary/SubarrayArbitrary.ts
  16. +10 −2 src/check/model/commands/CommandsArbitrary.ts
  17. +23 −3 src/fast-check-default.ts
  18. +32 −0 test/e2e/NoRegressionBigInt.spec.ts
  19. +512 −0 test/e2e/__snapshots__/NoRegressionBigInt.spec.ts.snap
  20. +1 −1 test/esm/rollup-with-import/package.json
  21. +4 −4 test/esm/rollup-with-import/yarn.lock
  22. +1 −1 test/esm/rollup-with-require/package.json
  23. +4 −4 test/esm/rollup-with-require/yarn.lock
  24. +3 −0 test/esm/webpack-with-import/buildWebpackConfig.js
  25. +2 −1 test/esm/webpack-with-import/package.json
  26. +251 −5,083 test/esm/webpack-with-import/yarn.lock
  27. +3 −0 test/esm/webpack-with-require/buildWebpackConfig.js
  28. +1 −1 test/esm/webpack-with-require/expectedResult.txt
  29. +2 −1 test/esm/webpack-with-require/package.json
  30. +180 −1,110 test/esm/webpack-with-require/yarn.lock
  31. +44 −10 test/unit/check/arbitrary/BigIntArbitrary.spec.ts
  32. +6 −1 test/unit/check/arbitrary/DateArbitrary.utest.spec.ts
  33. +97 −28 test/unit/check/arbitrary/FloatingPointArbitrary.spec.ts
  34. +39 −0 test/unit/check/arbitrary/IntegerArbitrary.spec.ts
  35. +7 −1 test/unit/check/arbitrary/UuidArbitrary.utest.spec.ts
  36. +1 −1 test/unit/check/runner/configuration/QualifiedParameters.spec.ts
  37. +295 −295 yarn.lock
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 2.6.0

_Towards a uniform way to constrain arbitraries - step 3: number arbitraries_
[[Code](https://github.com/dubzzz/fast-check/tree/v2.6.0)][[Diff](https://github.com/dubzzz/fast-check/compare/v2.5.0...v2.6.0)]

## Features

- ([PR#1067](https://github.com/dubzzz/fast-check/pull/1067)) Unify signatures on arbitraries: fc.bigInt and fc.bigUint (see [#992](https://github.com/dubzzz/fast-check/issues/992))
- ([PR#1068](https://github.com/dubzzz/fast-check/pull/1068)) Unify signatures on arbitraries: fc.float and fc.double (see [#992](https://github.com/dubzzz/fast-check/issues/992))
- ([PR#1076](https://github.com/dubzzz/fast-check/pull/1076)) Unify signatures on arbitraries: fc.integer and fc.nat (see [#992](https://github.com/dubzzz/fast-check/issues/992))
- ([PR#1080](https://github.com/dubzzz/fast-check/pull/1080)) Mark old signatures as deprecated (see [#992](https://github.com/dubzzz/fast-check/issues/992))

---

# 2.5.0

_Towards a uniform way to constrain arbitraries - step 2: remaining arbitraries except number related ones_
43 changes: 43 additions & 0 deletions codemods/unify-signatures/snippet-5.js
Original file line number Diff line number Diff line change
@@ -70,3 +70,46 @@ fc.lorem(10, false);
fc.lorem(10, something);
fc.lorem(num, something);
fc.lorem({ maxCount: 10 });

// bigInt

fc.bigInt();
fc.bigInt(1n, 3n);
fc.bigInt(BigInt(1), BigInt(3));
fc.bigInt({ min: 1n, max: 3n });

// bigUint

fc.bigUint();
fc.bigUint(3n);
fc.bigUint(BigInt(3));
fc.bigUint({ max: 3n });

// float

fc.float();
fc.float(1.0);
fc.float(2.0);
fc.float(0.0, 1.0);
fc.float(0.0, 2.0);
fc.float(-1.0, 1.0);
fc.float(-1.0, 2.0);
fc.float({ min: -1.0, max: 2.0 });

// nat

fc.nat();
fc.nat(10);
fc.nat(0x7fffffff);
fc.nat(2147483647);

// integer

fc.integer();
fc.integer(10);
fc.integer(0x7fffffff);
fc.integer(2147483647);
fc.integer(-1, 10);
fc.integer(-0x80000000, 0x7fffffff);
fc.integer(-2147483648, 2147483647);
fc.integer({ min: -1, max: 1 });
84 changes: 84 additions & 0 deletions codemods/unify-signatures/transform.cjs
Original file line number Diff line number Diff line change
@@ -154,6 +154,11 @@ module.exports = function (file, api, options) {
}

function isNumericValue(argument, value) {
if (value < 0) {
return (
argument.type === 'UnaryExpression' && argument.operator === '-' && isNumericValue(argument.argument, -value)
);
}
return isNumeric(argument) && argument.value === value;
}
function getArrayLength(argument) {
@@ -349,6 +354,85 @@ module.exports = function (file, api, options) {
}
break;
}
case 'bigInt': {
if (p.value.arguments.length === 2) {
// fc.bigInt(min, max) -> fc.bigInt({min, max})
p.value.arguments = computeNewArguments(
[],
[
j.property('init', j.identifier('min'), p.value.arguments[0]),
j.property('init', j.identifier('max'), p.value.arguments[1]),
]
);
}
break;
}
case 'bigUint': {
if (p.value.arguments.length === 1 && p.value.arguments[0].type !== 'ObjectExpression') {
// fc.bigUint(max) -> fc.bigUint({max})
p.value.arguments = computeNewArguments(
[],
[j.property('init', j.identifier('max'), p.value.arguments[0])]
);
}
break;
}
case 'double':
case 'float': {
if (p.value.arguments.length === 1 && p.value.arguments[0].type !== 'ObjectExpression') {
// fc.float(max) -> fc.float({max})
const simplifyMax = options.simplifyMax && isNumericValue(p.value.arguments[0], 1.0);
p.value.arguments = computeNewArguments(
[],
[!simplifyMax && j.property('init', j.identifier('max'), p.value.arguments[0])]
);
} else if (p.value.arguments.length === 2) {
// fc.float(min, max) -> fc.float({min, max})
const simplifyMin = options.simplifyMin && isNumericValue(p.value.arguments[0], 0.0);
const simplifyMax = options.simplifyMax && isNumericValue(p.value.arguments[1], 1.0);
p.value.arguments = computeNewArguments(
[],
[
!simplifyMin && j.property('init', j.identifier('min'), p.value.arguments[0]),
!simplifyMax && j.property('init', j.identifier('max'), p.value.arguments[1]),
]
);
}
break;
}
case 'nat': {
if (p.value.arguments.length === 1 && p.value.arguments[0].type !== 'ObjectExpression') {
// fc.nat(max) -> fc.nat({max})
const simplifyMax = options.simplifyMax && isNumericValue(p.value.arguments[0], 0x7fffffff);
p.value.arguments = computeNewArguments(
[],
[!simplifyMax && j.property('init', j.identifier('max'), p.value.arguments[0])]
);
}
break;
}
case 'integer': {
if (p.value.arguments.length === 1 && p.value.arguments[0].type !== 'ObjectExpression') {
// fc.integer(max) -> fc.integer({max})
const simplifyMax = options.simplifyMax && isNumericValue(p.value.arguments[0], 0x7fffffff);
p.value.arguments = computeNewArguments(
[],
[!simplifyMax && j.property('init', j.identifier('max'), p.value.arguments[0])]
);
} else if (p.value.arguments.length === 2) {
// fc.integer(min, max) -> fc.integer({min, max})
const simplifyMin = options.simplifyMin && isNumericValue(p.value.arguments[0], -0x80000000);
const simplifyMax = options.simplifyMax && isNumericValue(p.value.arguments[1], 0x7fffffff);
p.value.arguments = computeNewArguments(
[],
[
!simplifyMin && j.property('init', j.identifier('min'), p.value.arguments[0]),
!simplifyMax && j.property('init', j.identifier('max'), p.value.arguments[1]),
]
);
}
break;
}
}
return p;
})
Loading