Aktueller Stand
This commit is contained in:
100
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ArrayInt64.js
generated
vendored
Normal file
100
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ArrayInt64.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Unit64 = exports.Zero64 = void 0;
|
||||
exports.isZero64 = isZero64;
|
||||
exports.isStrictlyNegative64 = isStrictlyNegative64;
|
||||
exports.isStrictlyPositive64 = isStrictlyPositive64;
|
||||
exports.isEqual64 = isEqual64;
|
||||
exports.isStrictlySmaller64 = isStrictlySmaller64;
|
||||
exports.clone64 = clone64;
|
||||
exports.substract64 = substract64;
|
||||
exports.negative64 = negative64;
|
||||
exports.add64 = add64;
|
||||
exports.halve64 = halve64;
|
||||
exports.logLike64 = logLike64;
|
||||
exports.Zero64 = { sign: 1, data: [0, 0] };
|
||||
exports.Unit64 = { sign: 1, data: [0, 1] };
|
||||
function isZero64(a) {
|
||||
return a.data[0] === 0 && a.data[1] === 0;
|
||||
}
|
||||
function isStrictlyNegative64(a) {
|
||||
return a.sign === -1 && !isZero64(a);
|
||||
}
|
||||
function isStrictlyPositive64(a) {
|
||||
return a.sign === 1 && !isZero64(a);
|
||||
}
|
||||
function isEqual64(a, b) {
|
||||
if (a.data[0] === b.data[0] && a.data[1] === b.data[1]) {
|
||||
return a.sign === b.sign || (a.data[0] === 0 && a.data[1] === 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isStrictlySmaller64Internal(a, b) {
|
||||
return a[0] < b[0] || (a[0] === b[0] && a[1] < b[1]);
|
||||
}
|
||||
function isStrictlySmaller64(a, b) {
|
||||
if (a.sign === b.sign) {
|
||||
return a.sign === 1
|
||||
? isStrictlySmaller64Internal(a.data, b.data)
|
||||
: isStrictlySmaller64Internal(b.data, a.data);
|
||||
}
|
||||
return a.sign === -1 && (!isZero64(a) || !isZero64(b));
|
||||
}
|
||||
function clone64(a) {
|
||||
return { sign: a.sign, data: [a.data[0], a.data[1]] };
|
||||
}
|
||||
function substract64DataInternal(a, b) {
|
||||
let reminderLow = 0;
|
||||
let low = a[1] - b[1];
|
||||
if (low < 0) {
|
||||
reminderLow = 1;
|
||||
low = low >>> 0;
|
||||
}
|
||||
return [a[0] - b[0] - reminderLow, low];
|
||||
}
|
||||
function substract64Internal(a, b) {
|
||||
if (a.sign === 1 && b.sign === -1) {
|
||||
const low = a.data[1] + b.data[1];
|
||||
const high = a.data[0] + b.data[0] + (low > 0xffffffff ? 1 : 0);
|
||||
return { sign: 1, data: [high >>> 0, low >>> 0] };
|
||||
}
|
||||
return {
|
||||
sign: 1,
|
||||
data: a.sign === 1 ? substract64DataInternal(a.data, b.data) : substract64DataInternal(b.data, a.data),
|
||||
};
|
||||
}
|
||||
function substract64(arrayIntA, arrayIntB) {
|
||||
if (isStrictlySmaller64(arrayIntA, arrayIntB)) {
|
||||
const out = substract64Internal(arrayIntB, arrayIntA);
|
||||
out.sign = -1;
|
||||
return out;
|
||||
}
|
||||
return substract64Internal(arrayIntA, arrayIntB);
|
||||
}
|
||||
function negative64(arrayIntA) {
|
||||
return {
|
||||
sign: -arrayIntA.sign,
|
||||
data: [arrayIntA.data[0], arrayIntA.data[1]],
|
||||
};
|
||||
}
|
||||
function add64(arrayIntA, arrayIntB) {
|
||||
if (isZero64(arrayIntB)) {
|
||||
if (isZero64(arrayIntA)) {
|
||||
return clone64(exports.Zero64);
|
||||
}
|
||||
return clone64(arrayIntA);
|
||||
}
|
||||
return substract64(arrayIntA, negative64(arrayIntB));
|
||||
}
|
||||
function halve64(a) {
|
||||
return {
|
||||
sign: a.sign,
|
||||
data: [Math.floor(a.data[0] / 2), (a.data[0] % 2 === 1 ? 0x80000000 : 0) + Math.floor(a.data[1] / 2)],
|
||||
};
|
||||
}
|
||||
function logLike64(a) {
|
||||
return {
|
||||
sign: a.sign,
|
||||
data: [0, Math.floor(Math.log(a.data[0] * 0x100000000 + a.data[1]) / Math.log(2))],
|
||||
};
|
||||
}
|
||||
36
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BiasNumericRange.js
generated
vendored
Normal file
36
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BiasNumericRange.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.integerLogLike = integerLogLike;
|
||||
exports.bigIntLogLike = bigIntLogLike;
|
||||
exports.biasNumericRange = biasNumericRange;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeMathFloor = Math.floor;
|
||||
const safeMathLog = Math.log;
|
||||
function integerLogLike(v) {
|
||||
return safeMathFloor(safeMathLog(v) / safeMathLog(2));
|
||||
}
|
||||
function bigIntLogLike(v) {
|
||||
if (v === (0, globals_1.BigInt)(0))
|
||||
return (0, globals_1.BigInt)(0);
|
||||
return (0, globals_1.BigInt)((0, globals_1.String)(v).length);
|
||||
}
|
||||
function biasNumericRange(min, max, logLike) {
|
||||
if (min === max) {
|
||||
return [{ min: min, max: max }];
|
||||
}
|
||||
if (min < 0 && max > 0) {
|
||||
const logMin = logLike(-min);
|
||||
const logMax = logLike(max);
|
||||
return [
|
||||
{ min: -logMin, max: logMax },
|
||||
{ min: (max - logMax), max: max },
|
||||
{ min: min, max: min + logMin },
|
||||
];
|
||||
}
|
||||
const logGap = logLike((max - min));
|
||||
const arbCloseToMin = { min: min, max: min + logGap };
|
||||
const arbCloseToMax = { min: (max - logGap), max: max };
|
||||
return min < 0
|
||||
? [arbCloseToMax, arbCloseToMin]
|
||||
: [arbCloseToMin, arbCloseToMax];
|
||||
}
|
||||
24
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BuildSchedulerFor.js
generated
vendored
Normal file
24
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BuildSchedulerFor.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildSchedulerFor = buildSchedulerFor;
|
||||
const SchedulerImplem_1 = require("../implementations/SchedulerImplem");
|
||||
function buildNextTaskIndex(ordering) {
|
||||
let numTasks = 0;
|
||||
return {
|
||||
clone: () => buildNextTaskIndex(ordering),
|
||||
nextTaskIndex: (scheduledTasks) => {
|
||||
if (ordering.length <= numTasks) {
|
||||
throw new Error(`Invalid schedulerFor defined: too many tasks have been scheduled`);
|
||||
}
|
||||
const taskIndex = scheduledTasks.findIndex((t) => t.taskId === ordering[numTasks]);
|
||||
if (taskIndex === -1) {
|
||||
throw new Error(`Invalid schedulerFor defined: unable to find next task`);
|
||||
}
|
||||
++numTasks;
|
||||
return taskIndex;
|
||||
},
|
||||
};
|
||||
}
|
||||
function buildSchedulerFor(act, ordering) {
|
||||
return new SchedulerImplem_1.SchedulerImplem(act, buildNextTaskIndex(ordering));
|
||||
}
|
||||
11
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BuildSlicedGenerator.js
generated
vendored
Normal file
11
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/BuildSlicedGenerator.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildSlicedGenerator = buildSlicedGenerator;
|
||||
const NoopSlicedGenerator_1 = require("../implementations/NoopSlicedGenerator");
|
||||
const SlicedBasedGenerator_1 = require("../implementations/SlicedBasedGenerator");
|
||||
function buildSlicedGenerator(arb, mrng, slices, biasFactor) {
|
||||
if (biasFactor === undefined || slices.length === 0 || mrng.nextInt(1, biasFactor) !== 1) {
|
||||
return new NoopSlicedGenerator_1.NoopSlicedGenerator(arb, mrng, biasFactor);
|
||||
}
|
||||
return new SlicedBasedGenerator_1.SlicedBasedGenerator(arb, mrng, slices, biasFactor);
|
||||
}
|
||||
26
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/CustomEqualSet.js
generated
vendored
Normal file
26
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/CustomEqualSet.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CustomEqualSet = void 0;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
class CustomEqualSet {
|
||||
constructor(isEqual) {
|
||||
this.isEqual = isEqual;
|
||||
this.data = [];
|
||||
}
|
||||
tryAdd(value) {
|
||||
for (let idx = 0; idx !== this.data.length; ++idx) {
|
||||
if (this.isEqual(this.data[idx], value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
size() {
|
||||
return this.data.length;
|
||||
}
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
exports.CustomEqualSet = CustomEqualSet;
|
||||
25
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DepthContext.js
generated
vendored
Normal file
25
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DepthContext.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getDepthContextFor = getDepthContextFor;
|
||||
exports.createDepthIdentifier = createDepthIdentifier;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const depthContextCache = new Map();
|
||||
function getDepthContextFor(contextMeta) {
|
||||
if (contextMeta === undefined) {
|
||||
return { depth: 0 };
|
||||
}
|
||||
if (typeof contextMeta !== 'string') {
|
||||
return contextMeta;
|
||||
}
|
||||
const cachedContext = (0, globals_1.safeMapGet)(depthContextCache, contextMeta);
|
||||
if (cachedContext !== undefined) {
|
||||
return cachedContext;
|
||||
}
|
||||
const context = { depth: 0 };
|
||||
(0, globals_1.safeMapSet)(depthContextCache, contextMeta, context);
|
||||
return context;
|
||||
}
|
||||
function createDepthIdentifier() {
|
||||
const identifier = { depth: 0 };
|
||||
return identifier;
|
||||
}
|
||||
90
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DoubleHelpers.js
generated
vendored
Normal file
90
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DoubleHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decomposeDouble = decomposeDouble;
|
||||
exports.doubleToIndex = doubleToIndex;
|
||||
exports.indexToDouble = indexToDouble;
|
||||
const ArrayInt64_1 = require("./ArrayInt64");
|
||||
const safeNegativeInfinity = Number.NEGATIVE_INFINITY;
|
||||
const safePositiveInfinity = Number.POSITIVE_INFINITY;
|
||||
const safeEpsilon = Number.EPSILON;
|
||||
const INDEX_POSITIVE_INFINITY = { sign: 1, data: [2146435072, 0] };
|
||||
const INDEX_NEGATIVE_INFINITY = { sign: -1, data: [2146435072, 1] };
|
||||
const f64 = new Float64Array(1);
|
||||
const u32 = new Uint32Array(f64.buffer, f64.byteOffset);
|
||||
function bitCastDoubleToUInt64(f) {
|
||||
f64[0] = f;
|
||||
return [u32[1], u32[0]];
|
||||
}
|
||||
function decomposeDouble(d) {
|
||||
const { 0: hi, 1: lo } = bitCastDoubleToUInt64(d);
|
||||
const signBit = hi >>> 31;
|
||||
const exponentBits = (hi >>> 20) & 0x7ff;
|
||||
const significandBits = (hi & 0xfffff) * 0x100000000 + lo;
|
||||
const exponent = exponentBits === 0 ? -1022 : exponentBits - 1023;
|
||||
let significand = exponentBits === 0 ? 0 : 1;
|
||||
significand += significandBits / 2 ** 52;
|
||||
significand *= signBit === 0 ? 1 : -1;
|
||||
return { exponent, significand };
|
||||
}
|
||||
function positiveNumberToInt64(n) {
|
||||
return [~~(n / 0x100000000), n >>> 0];
|
||||
}
|
||||
function indexInDoubleFromDecomp(exponent, significand) {
|
||||
if (exponent === -1022) {
|
||||
const rescaledSignificand = significand * 2 ** 52;
|
||||
return positiveNumberToInt64(rescaledSignificand);
|
||||
}
|
||||
const rescaledSignificand = (significand - 1) * 2 ** 52;
|
||||
const exponentOnlyHigh = (exponent + 1023) * 2 ** 20;
|
||||
const index = positiveNumberToInt64(rescaledSignificand);
|
||||
index[0] += exponentOnlyHigh;
|
||||
return index;
|
||||
}
|
||||
function doubleToIndex(d) {
|
||||
if (d === safePositiveInfinity) {
|
||||
return (0, ArrayInt64_1.clone64)(INDEX_POSITIVE_INFINITY);
|
||||
}
|
||||
if (d === safeNegativeInfinity) {
|
||||
return (0, ArrayInt64_1.clone64)(INDEX_NEGATIVE_INFINITY);
|
||||
}
|
||||
const decomp = decomposeDouble(d);
|
||||
const exponent = decomp.exponent;
|
||||
const significand = decomp.significand;
|
||||
if (d > 0 || (d === 0 && 1 / d === safePositiveInfinity)) {
|
||||
return { sign: 1, data: indexInDoubleFromDecomp(exponent, significand) };
|
||||
}
|
||||
else {
|
||||
const indexOpposite = indexInDoubleFromDecomp(exponent, -significand);
|
||||
if (indexOpposite[1] === 0xffffffff) {
|
||||
indexOpposite[0] += 1;
|
||||
indexOpposite[1] = 0;
|
||||
}
|
||||
else {
|
||||
indexOpposite[1] += 1;
|
||||
}
|
||||
return { sign: -1, data: indexOpposite };
|
||||
}
|
||||
}
|
||||
function indexToDouble(index) {
|
||||
if (index.sign === -1) {
|
||||
const indexOpposite = { sign: 1, data: [index.data[0], index.data[1]] };
|
||||
if (indexOpposite.data[1] === 0) {
|
||||
indexOpposite.data[0] -= 1;
|
||||
indexOpposite.data[1] = 0xffffffff;
|
||||
}
|
||||
else {
|
||||
indexOpposite.data[1] -= 1;
|
||||
}
|
||||
return -indexToDouble(indexOpposite);
|
||||
}
|
||||
if ((0, ArrayInt64_1.isEqual64)(index, INDEX_POSITIVE_INFINITY)) {
|
||||
return safePositiveInfinity;
|
||||
}
|
||||
if (index.data[0] < 0x200000) {
|
||||
return (index.data[0] * 0x100000000 + index.data[1]) * 2 ** -1074;
|
||||
}
|
||||
const postIndexHigh = index.data[0] - 0x200000;
|
||||
const exponent = -1021 + (postIndexHigh >> 20);
|
||||
const significand = 1 + ((postIndexHigh & 0xfffff) * 2 ** 32 + index.data[1]) * safeEpsilon;
|
||||
return significand * 2 ** exponent;
|
||||
}
|
||||
31
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DoubleOnlyHelpers.js
generated
vendored
Normal file
31
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/DoubleOnlyHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.onlyIntegersAfterThisValue = exports.maxNonIntegerValue = void 0;
|
||||
exports.refineConstraintsForDoubleOnly = refineConstraintsForDoubleOnly;
|
||||
exports.doubleOnlyMapper = doubleOnlyMapper;
|
||||
exports.doubleOnlyUnmapper = doubleOnlyUnmapper;
|
||||
const FloatingOnlyHelpers_1 = require("./FloatingOnlyHelpers");
|
||||
const safeNegativeInfinity = Number.NEGATIVE_INFINITY;
|
||||
const safePositiveInfinity = Number.POSITIVE_INFINITY;
|
||||
const safeMaxValue = Number.MAX_VALUE;
|
||||
exports.maxNonIntegerValue = 4503599627370495.5;
|
||||
exports.onlyIntegersAfterThisValue = 4503599627370496;
|
||||
function refineConstraintsForDoubleOnly(constraints) {
|
||||
return (0, FloatingOnlyHelpers_1.refineConstraintsForFloatingOnly)(constraints, safeMaxValue, exports.maxNonIntegerValue, exports.onlyIntegersAfterThisValue);
|
||||
}
|
||||
function doubleOnlyMapper(value) {
|
||||
return value === exports.onlyIntegersAfterThisValue
|
||||
? safePositiveInfinity
|
||||
: value === -exports.onlyIntegersAfterThisValue
|
||||
? safeNegativeInfinity
|
||||
: value;
|
||||
}
|
||||
function doubleOnlyUnmapper(value) {
|
||||
if (typeof value !== 'number')
|
||||
throw new Error('Unsupported type');
|
||||
return value === safePositiveInfinity
|
||||
? exports.onlyIntegersAfterThisValue
|
||||
: value === safeNegativeInfinity
|
||||
? -exports.onlyIntegersAfterThisValue
|
||||
: value;
|
||||
}
|
||||
18
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/EnumerableKeysExtractor.js
generated
vendored
Normal file
18
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/EnumerableKeysExtractor.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extractEnumerableKeys = extractEnumerableKeys;
|
||||
const safeObjectKeys = Object.keys;
|
||||
const safeObjectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
const safeObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
function extractEnumerableKeys(instance) {
|
||||
const keys = safeObjectKeys(instance);
|
||||
const symbols = safeObjectGetOwnPropertySymbols(instance);
|
||||
for (let index = 0; index !== symbols.length; ++index) {
|
||||
const symbol = symbols[index];
|
||||
const descriptor = safeObjectGetOwnPropertyDescriptor(instance, symbol);
|
||||
if (descriptor && descriptor.enumerable) {
|
||||
keys.push(symbol);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
68
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatHelpers.js
generated
vendored
Normal file
68
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EPSILON_32 = exports.MAX_VALUE_32 = exports.MIN_VALUE_32 = void 0;
|
||||
exports.decomposeFloat = decomposeFloat;
|
||||
exports.floatToIndex = floatToIndex;
|
||||
exports.indexToFloat = indexToFloat;
|
||||
const safeNegativeInfinity = Number.NEGATIVE_INFINITY;
|
||||
const safePositiveInfinity = Number.POSITIVE_INFINITY;
|
||||
exports.MIN_VALUE_32 = 2 ** -126 * 2 ** -23;
|
||||
exports.MAX_VALUE_32 = 2 ** 127 * (1 + (2 ** 23 - 1) / 2 ** 23);
|
||||
exports.EPSILON_32 = 2 ** -23;
|
||||
const INDEX_POSITIVE_INFINITY = 2139095040;
|
||||
const INDEX_NEGATIVE_INFINITY = -2139095041;
|
||||
const f32 = new Float32Array(1);
|
||||
const u32 = new Uint32Array(f32.buffer, f32.byteOffset);
|
||||
function bitCastFloatToUInt32(f) {
|
||||
f32[0] = f;
|
||||
return u32[0];
|
||||
}
|
||||
function decomposeFloat(f) {
|
||||
const bits = bitCastFloatToUInt32(f);
|
||||
const signBit = bits >>> 31;
|
||||
const exponentBits = (bits >>> 23) & 0xff;
|
||||
const significandBits = bits & 0x7fffff;
|
||||
const exponent = exponentBits === 0 ? -126 : exponentBits - 127;
|
||||
let significand = exponentBits === 0 ? 0 : 1;
|
||||
significand += significandBits / 2 ** 23;
|
||||
significand *= signBit === 0 ? 1 : -1;
|
||||
return { exponent, significand };
|
||||
}
|
||||
function indexInFloatFromDecomp(exponent, significand) {
|
||||
if (exponent === -126) {
|
||||
return significand * 0x800000;
|
||||
}
|
||||
return (exponent + 127) * 0x800000 + (significand - 1) * 0x800000;
|
||||
}
|
||||
function floatToIndex(f) {
|
||||
if (f === safePositiveInfinity) {
|
||||
return INDEX_POSITIVE_INFINITY;
|
||||
}
|
||||
if (f === safeNegativeInfinity) {
|
||||
return INDEX_NEGATIVE_INFINITY;
|
||||
}
|
||||
const decomp = decomposeFloat(f);
|
||||
const exponent = decomp.exponent;
|
||||
const significand = decomp.significand;
|
||||
if (f > 0 || (f === 0 && 1 / f === safePositiveInfinity)) {
|
||||
return indexInFloatFromDecomp(exponent, significand);
|
||||
}
|
||||
else {
|
||||
return -indexInFloatFromDecomp(exponent, -significand) - 1;
|
||||
}
|
||||
}
|
||||
function indexToFloat(index) {
|
||||
if (index < 0) {
|
||||
return -indexToFloat(-index - 1);
|
||||
}
|
||||
if (index === INDEX_POSITIVE_INFINITY) {
|
||||
return safePositiveInfinity;
|
||||
}
|
||||
if (index < 0x1000000) {
|
||||
return index * 2 ** -149;
|
||||
}
|
||||
const postIndex = index - 0x1000000;
|
||||
const exponent = -125 + (postIndex >> 23);
|
||||
const significand = 1 + (postIndex & 0x7fffff) / 0x800000;
|
||||
return significand * 2 ** exponent;
|
||||
}
|
||||
32
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatOnlyHelpers.js
generated
vendored
Normal file
32
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatOnlyHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.onlyIntegersAfterThisValue = exports.maxNonIntegerValue = void 0;
|
||||
exports.refineConstraintsForFloatOnly = refineConstraintsForFloatOnly;
|
||||
exports.floatOnlyMapper = floatOnlyMapper;
|
||||
exports.floatOnlyUnmapper = floatOnlyUnmapper;
|
||||
const FloatHelpers_1 = require("./FloatHelpers");
|
||||
const FloatingOnlyHelpers_1 = require("./FloatingOnlyHelpers");
|
||||
const safeNegativeInfinity = Number.NEGATIVE_INFINITY;
|
||||
const safePositiveInfinity = Number.POSITIVE_INFINITY;
|
||||
const safeMaxValue = FloatHelpers_1.MAX_VALUE_32;
|
||||
exports.maxNonIntegerValue = 8388607.5;
|
||||
exports.onlyIntegersAfterThisValue = 8388608;
|
||||
function refineConstraintsForFloatOnly(constraints) {
|
||||
return (0, FloatingOnlyHelpers_1.refineConstraintsForFloatingOnly)(constraints, safeMaxValue, exports.maxNonIntegerValue, exports.onlyIntegersAfterThisValue);
|
||||
}
|
||||
function floatOnlyMapper(value) {
|
||||
return value === exports.onlyIntegersAfterThisValue
|
||||
? safePositiveInfinity
|
||||
: value === -exports.onlyIntegersAfterThisValue
|
||||
? safeNegativeInfinity
|
||||
: value;
|
||||
}
|
||||
function floatOnlyUnmapper(value) {
|
||||
if (typeof value !== 'number')
|
||||
throw new Error('Unsupported type');
|
||||
return value === safePositiveInfinity
|
||||
? exports.onlyIntegersAfterThisValue
|
||||
: value === safeNegativeInfinity
|
||||
? -exports.onlyIntegersAfterThisValue
|
||||
: value;
|
||||
}
|
||||
33
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatingOnlyHelpers.js
generated
vendored
Normal file
33
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/FloatingOnlyHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.refineConstraintsForFloatingOnly = refineConstraintsForFloatingOnly;
|
||||
const safeNumberIsInteger = Number.isInteger;
|
||||
const safeObjectIs = Object.is;
|
||||
const safeNegativeInfinity = Number.NEGATIVE_INFINITY;
|
||||
const safePositiveInfinity = Number.POSITIVE_INFINITY;
|
||||
function refineConstraintsForFloatingOnly(constraints, maxValue, maxNonIntegerValue, onlyIntegersAfterThisValue) {
|
||||
const { noDefaultInfinity = false, minExcluded = false, maxExcluded = false, min = noDefaultInfinity ? -maxValue : safeNegativeInfinity, max = noDefaultInfinity ? maxValue : safePositiveInfinity, } = constraints;
|
||||
const effectiveMin = minExcluded
|
||||
? min < -maxNonIntegerValue
|
||||
? -onlyIntegersAfterThisValue
|
||||
: Math.max(min, -maxNonIntegerValue)
|
||||
: min === safeNegativeInfinity
|
||||
? Math.max(min, -onlyIntegersAfterThisValue)
|
||||
: Math.max(min, -maxNonIntegerValue);
|
||||
const effectiveMax = maxExcluded
|
||||
? max > maxNonIntegerValue
|
||||
? onlyIntegersAfterThisValue
|
||||
: Math.min(max, maxNonIntegerValue)
|
||||
: max === safePositiveInfinity
|
||||
? Math.min(max, onlyIntegersAfterThisValue)
|
||||
: Math.min(max, maxNonIntegerValue);
|
||||
const fullConstraints = {
|
||||
noDefaultInfinity: false,
|
||||
minExcluded: minExcluded || ((min !== safeNegativeInfinity || minExcluded) && safeNumberIsInteger(effectiveMin)),
|
||||
maxExcluded: maxExcluded || ((max !== safePositiveInfinity || maxExcluded) && safeNumberIsInteger(effectiveMax)),
|
||||
min: safeObjectIs(effectiveMin, -0) ? 0 : effectiveMin,
|
||||
max: safeObjectIs(effectiveMax, 0) ? -0 : effectiveMax,
|
||||
noNaN: constraints.noNaN || false,
|
||||
};
|
||||
return fullConstraints;
|
||||
}
|
||||
55
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/GraphemeRangesHelpers.js
generated
vendored
Normal file
55
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/GraphemeRangesHelpers.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.convertGraphemeRangeToMapToConstantEntry = convertGraphemeRangeToMapToConstantEntry;
|
||||
exports.intersectGraphemeRanges = intersectGraphemeRanges;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeStringFromCodePoint = String.fromCodePoint;
|
||||
const safeMathMin = Math.min;
|
||||
const safeMathMax = Math.max;
|
||||
function convertGraphemeRangeToMapToConstantEntry(range) {
|
||||
if (range.length === 1) {
|
||||
const codePointString = safeStringFromCodePoint(range[0]);
|
||||
return { num: 1, build: () => codePointString };
|
||||
}
|
||||
const rangeStart = range[0];
|
||||
return { num: range[1] - range[0] + 1, build: (idInGroup) => safeStringFromCodePoint(rangeStart + idInGroup) };
|
||||
}
|
||||
function intersectGraphemeRanges(rangesA, rangesB) {
|
||||
const mergedRanges = [];
|
||||
let cursorA = 0;
|
||||
let cursorB = 0;
|
||||
while (cursorA < rangesA.length && cursorB < rangesB.length) {
|
||||
const rangeA = rangesA[cursorA];
|
||||
const rangeAMin = rangeA[0];
|
||||
const rangeAMax = rangeA.length === 1 ? rangeA[0] : rangeA[1];
|
||||
const rangeB = rangesB[cursorB];
|
||||
const rangeBMin = rangeB[0];
|
||||
const rangeBMax = rangeB.length === 1 ? rangeB[0] : rangeB[1];
|
||||
if (rangeAMax < rangeBMin) {
|
||||
cursorA += 1;
|
||||
}
|
||||
else if (rangeBMax < rangeAMin) {
|
||||
cursorB += 1;
|
||||
}
|
||||
else {
|
||||
let min = safeMathMax(rangeAMin, rangeBMin);
|
||||
const max = safeMathMin(rangeAMax, rangeBMax);
|
||||
if (mergedRanges.length >= 1) {
|
||||
const lastMergedRange = mergedRanges[mergedRanges.length - 1];
|
||||
const lastMergedRangeMax = lastMergedRange.length === 1 ? lastMergedRange[0] : lastMergedRange[1];
|
||||
if (lastMergedRangeMax + 1 === min) {
|
||||
min = lastMergedRange[0];
|
||||
(0, globals_1.safePop)(mergedRanges);
|
||||
}
|
||||
}
|
||||
(0, globals_1.safePush)(mergedRanges, min === max ? [min] : [min, max]);
|
||||
if (rangeAMax <= max) {
|
||||
cursorA += 1;
|
||||
}
|
||||
if (rangeBMax <= max) {
|
||||
cursorB += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mergedRanges;
|
||||
}
|
||||
13
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/InvalidSubdomainLabelFiIter.js
generated
vendored
Normal file
13
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/InvalidSubdomainLabelFiIter.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.filterInvalidSubdomainLabel = filterInvalidSubdomainLabel;
|
||||
function filterInvalidSubdomainLabel(subdomainLabel) {
|
||||
if (subdomainLabel.length > 63) {
|
||||
return false;
|
||||
}
|
||||
return (subdomainLabel.length < 4 ||
|
||||
subdomainLabel[0] !== 'x' ||
|
||||
subdomainLabel[1] !== 'n' ||
|
||||
subdomainLabel[2] !== '-' ||
|
||||
subdomainLabel[3] !== '-');
|
||||
}
|
||||
36
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/IsSubarrayOf.js
generated
vendored
Normal file
36
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/IsSubarrayOf.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isSubarrayOf = isSubarrayOf;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeObjectIs = Object.is;
|
||||
function isSubarrayOf(source, small) {
|
||||
const countMap = new globals_1.Map();
|
||||
let countMinusZero = 0;
|
||||
for (const sourceEntry of source) {
|
||||
if (safeObjectIs(sourceEntry, -0)) {
|
||||
++countMinusZero;
|
||||
}
|
||||
else {
|
||||
const oldCount = (0, globals_1.safeMapGet)(countMap, sourceEntry) || 0;
|
||||
(0, globals_1.safeMapSet)(countMap, sourceEntry, oldCount + 1);
|
||||
}
|
||||
}
|
||||
for (let index = 0; index !== small.length; ++index) {
|
||||
if (!(index in small)) {
|
||||
return false;
|
||||
}
|
||||
const smallEntry = small[index];
|
||||
if (safeObjectIs(smallEntry, -0)) {
|
||||
if (countMinusZero === 0)
|
||||
return false;
|
||||
--countMinusZero;
|
||||
}
|
||||
else {
|
||||
const oldCount = (0, globals_1.safeMapGet)(countMap, smallEntry) || 0;
|
||||
if (oldCount === 0)
|
||||
return false;
|
||||
(0, globals_1.safeMapSet)(countMap, smallEntry, oldCount - 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
17
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/JsonConstraintsBuilder.js
generated
vendored
Normal file
17
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/JsonConstraintsBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jsonConstraintsBuilder = jsonConstraintsBuilder;
|
||||
const boolean_1 = require("../../boolean");
|
||||
const constant_1 = require("../../constant");
|
||||
const double_1 = require("../../double");
|
||||
function jsonConstraintsBuilder(stringArbitrary, constraints) {
|
||||
const { depthSize, maxDepth } = constraints;
|
||||
const key = stringArbitrary;
|
||||
const values = [
|
||||
(0, boolean_1.boolean)(),
|
||||
(0, double_1.double)({ noDefaultInfinity: true, noNaN: true }),
|
||||
stringArbitrary,
|
||||
(0, constant_1.constant)(null),
|
||||
];
|
||||
return { key, values, depthSize, maxDepth };
|
||||
}
|
||||
91
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/MaxLengthFromMinLength.js
generated
vendored
Normal file
91
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/MaxLengthFromMinLength.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultSize = exports.MaxLengthUpperBound = void 0;
|
||||
exports.maxLengthFromMinLength = maxLengthFromMinLength;
|
||||
exports.relativeSizeToSize = relativeSizeToSize;
|
||||
exports.maxGeneratedLengthFromSizeForArbitrary = maxGeneratedLengthFromSizeForArbitrary;
|
||||
exports.depthBiasFromSizeForArbitrary = depthBiasFromSizeForArbitrary;
|
||||
exports.resolveSize = resolveSize;
|
||||
const GlobalParameters_1 = require("../../../check/runner/configuration/GlobalParameters");
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeMathFloor = Math.floor;
|
||||
const safeMathMin = Math.min;
|
||||
exports.MaxLengthUpperBound = 0x7fffffff;
|
||||
const orderedSize = ['xsmall', 'small', 'medium', 'large', 'xlarge'];
|
||||
const orderedRelativeSize = ['-4', '-3', '-2', '-1', '=', '+1', '+2', '+3', '+4'];
|
||||
exports.DefaultSize = 'small';
|
||||
function maxLengthFromMinLength(minLength, size) {
|
||||
switch (size) {
|
||||
case 'xsmall':
|
||||
return safeMathFloor(1.1 * minLength) + 1;
|
||||
case 'small':
|
||||
return 2 * minLength + 10;
|
||||
case 'medium':
|
||||
return 11 * minLength + 100;
|
||||
case 'large':
|
||||
return 101 * minLength + 1000;
|
||||
case 'xlarge':
|
||||
return 1001 * minLength + 10000;
|
||||
default:
|
||||
throw new Error(`Unable to compute lengths based on received size: ${size}`);
|
||||
}
|
||||
}
|
||||
function relativeSizeToSize(size, defaultSize) {
|
||||
const sizeInRelative = (0, globals_1.safeIndexOf)(orderedRelativeSize, size);
|
||||
if (sizeInRelative === -1) {
|
||||
return size;
|
||||
}
|
||||
const defaultSizeInSize = (0, globals_1.safeIndexOf)(orderedSize, defaultSize);
|
||||
if (defaultSizeInSize === -1) {
|
||||
throw new Error(`Unable to offset size based on the unknown defaulted one: ${defaultSize}`);
|
||||
}
|
||||
const resultingSizeInSize = defaultSizeInSize + sizeInRelative - 4;
|
||||
return resultingSizeInSize < 0
|
||||
? orderedSize[0]
|
||||
: resultingSizeInSize >= orderedSize.length
|
||||
? orderedSize[orderedSize.length - 1]
|
||||
: orderedSize[resultingSizeInSize];
|
||||
}
|
||||
function maxGeneratedLengthFromSizeForArbitrary(size, minLength, maxLength, specifiedMaxLength) {
|
||||
const { baseSize: defaultSize = exports.DefaultSize, defaultSizeToMaxWhenMaxSpecified } = (0, GlobalParameters_1.readConfigureGlobal)() || {};
|
||||
const definedSize = size !== undefined ? size : specifiedMaxLength && defaultSizeToMaxWhenMaxSpecified ? 'max' : defaultSize;
|
||||
if (definedSize === 'max') {
|
||||
return maxLength;
|
||||
}
|
||||
const finalSize = relativeSizeToSize(definedSize, defaultSize);
|
||||
return safeMathMin(maxLengthFromMinLength(minLength, finalSize), maxLength);
|
||||
}
|
||||
function depthBiasFromSizeForArbitrary(depthSizeOrSize, specifiedMaxDepth) {
|
||||
if (typeof depthSizeOrSize === 'number') {
|
||||
return 1 / depthSizeOrSize;
|
||||
}
|
||||
const { baseSize: defaultSize = exports.DefaultSize, defaultSizeToMaxWhenMaxSpecified } = (0, GlobalParameters_1.readConfigureGlobal)() || {};
|
||||
const definedSize = depthSizeOrSize !== undefined
|
||||
? depthSizeOrSize
|
||||
: specifiedMaxDepth && defaultSizeToMaxWhenMaxSpecified
|
||||
? 'max'
|
||||
: defaultSize;
|
||||
if (definedSize === 'max') {
|
||||
return 0;
|
||||
}
|
||||
const finalSize = relativeSizeToSize(definedSize, defaultSize);
|
||||
switch (finalSize) {
|
||||
case 'xsmall':
|
||||
return 1;
|
||||
case 'small':
|
||||
return 0.5;
|
||||
case 'medium':
|
||||
return 0.25;
|
||||
case 'large':
|
||||
return 0.125;
|
||||
case 'xlarge':
|
||||
return 0.0625;
|
||||
}
|
||||
}
|
||||
function resolveSize(size) {
|
||||
const { baseSize: defaultSize = exports.DefaultSize } = (0, GlobalParameters_1.readConfigureGlobal)() || {};
|
||||
if (size === undefined) {
|
||||
return defaultSize;
|
||||
}
|
||||
return relativeSizeToSize(size, defaultSize);
|
||||
}
|
||||
15
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/NoUndefinedAsContext.js
generated
vendored
Normal file
15
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/NoUndefinedAsContext.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UndefinedContextPlaceholder = void 0;
|
||||
exports.noUndefinedAsContext = noUndefinedAsContext;
|
||||
const Value_1 = require("../../../check/arbitrary/definition/Value");
|
||||
exports.UndefinedContextPlaceholder = Symbol('UndefinedContextPlaceholder');
|
||||
function noUndefinedAsContext(value) {
|
||||
if (value.context !== undefined) {
|
||||
return value;
|
||||
}
|
||||
if (value.hasToBeCloned) {
|
||||
return new Value_1.Value(value.value_, exports.UndefinedContextPlaceholder, () => value.value);
|
||||
}
|
||||
return new Value_1.Value(value.value_, exports.UndefinedContextPlaceholder);
|
||||
}
|
||||
49
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/QualifiedObjectConstraints.js
generated
vendored
Normal file
49
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/QualifiedObjectConstraints.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toQualifiedObjectConstraints = toQualifiedObjectConstraints;
|
||||
const boolean_1 = require("../../boolean");
|
||||
const constant_1 = require("../../constant");
|
||||
const double_1 = require("../../double");
|
||||
const fullUnicodeString_1 = require("../../fullUnicodeString");
|
||||
const maxSafeInteger_1 = require("../../maxSafeInteger");
|
||||
const oneof_1 = require("../../oneof");
|
||||
const string_1 = require("../../string");
|
||||
const BoxedArbitraryBuilder_1 = require("../builders/BoxedArbitraryBuilder");
|
||||
function defaultValues(constraints, stringArbitrary) {
|
||||
return [
|
||||
(0, boolean_1.boolean)(),
|
||||
(0, maxSafeInteger_1.maxSafeInteger)(),
|
||||
(0, double_1.double)(),
|
||||
stringArbitrary(constraints),
|
||||
(0, oneof_1.oneof)(stringArbitrary(constraints), (0, constant_1.constant)(null), (0, constant_1.constant)(undefined)),
|
||||
];
|
||||
}
|
||||
function boxArbitraries(arbs) {
|
||||
return arbs.map((arb) => (0, BoxedArbitraryBuilder_1.boxedArbitraryBuilder)(arb));
|
||||
}
|
||||
function boxArbitrariesIfNeeded(arbs, boxEnabled) {
|
||||
return boxEnabled ? boxArbitraries(arbs).concat(arbs) : arbs;
|
||||
}
|
||||
function toQualifiedObjectConstraints(settings = {}) {
|
||||
function orDefault(optionalValue, defaultValue) {
|
||||
return optionalValue !== undefined ? optionalValue : defaultValue;
|
||||
}
|
||||
const stringArbitrary = 'stringUnit' in settings ? string_1.string : settings.withUnicodeString ? fullUnicodeString_1.fullUnicodeString : string_1.string;
|
||||
const valueConstraints = { size: settings.size, unit: settings.stringUnit };
|
||||
return {
|
||||
key: orDefault(settings.key, stringArbitrary(valueConstraints)),
|
||||
values: boxArbitrariesIfNeeded(orDefault(settings.values, defaultValues(valueConstraints, stringArbitrary)), orDefault(settings.withBoxedValues, false)),
|
||||
depthSize: settings.depthSize,
|
||||
maxDepth: settings.maxDepth,
|
||||
maxKeys: settings.maxKeys,
|
||||
size: settings.size,
|
||||
withSet: orDefault(settings.withSet, false),
|
||||
withMap: orDefault(settings.withMap, false),
|
||||
withObjectString: orDefault(settings.withObjectString, false),
|
||||
withNullPrototype: orDefault(settings.withNullPrototype, false),
|
||||
withBigInt: orDefault(settings.withBigInt, false),
|
||||
withDate: orDefault(settings.withDate, false),
|
||||
withTypedArray: orDefault(settings.withTypedArray, false),
|
||||
withSparseArray: orDefault(settings.withSparseArray, false),
|
||||
};
|
||||
}
|
||||
211
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ReadRegex.js
generated
vendored
Normal file
211
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ReadRegex.js
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TokenizerBlockMode = void 0;
|
||||
exports.readFrom = readFrom;
|
||||
function charSizeAt(text, pos) {
|
||||
return text[pos] >= '\uD800' && text[pos] <= '\uDBFF' && text[pos + 1] >= '\uDC00' && text[pos + 1] <= '\uDFFF'
|
||||
? 2
|
||||
: 1;
|
||||
}
|
||||
function isHexaDigit(char) {
|
||||
return (char >= '0' && char <= '9') || (char >= 'a' && char <= 'f') || (char >= 'A' && char <= 'F');
|
||||
}
|
||||
function isDigit(char) {
|
||||
return char >= '0' && char <= '9';
|
||||
}
|
||||
function squaredBracketBlockContentEndFrom(text, from) {
|
||||
for (let index = from; index !== text.length; ++index) {
|
||||
const char = text[index];
|
||||
if (char === '\\') {
|
||||
index += 1;
|
||||
}
|
||||
else if (char === ']') {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
throw new Error(`Missing closing ']'`);
|
||||
}
|
||||
function parenthesisBlockContentEndFrom(text, from) {
|
||||
let numExtraOpened = 0;
|
||||
for (let index = from; index !== text.length; ++index) {
|
||||
const char = text[index];
|
||||
if (char === '\\') {
|
||||
index += 1;
|
||||
}
|
||||
else if (char === ')') {
|
||||
if (numExtraOpened === 0) {
|
||||
return index;
|
||||
}
|
||||
numExtraOpened -= 1;
|
||||
}
|
||||
else if (char === '[') {
|
||||
index = squaredBracketBlockContentEndFrom(text, index);
|
||||
}
|
||||
else if (char === '(') {
|
||||
numExtraOpened += 1;
|
||||
}
|
||||
}
|
||||
throw new Error(`Missing closing ')'`);
|
||||
}
|
||||
function curlyBracketBlockContentEndFrom(text, from) {
|
||||
let foundComma = false;
|
||||
for (let index = from; index !== text.length; ++index) {
|
||||
const char = text[index];
|
||||
if (isDigit(char)) {
|
||||
}
|
||||
else if (from === index) {
|
||||
return -1;
|
||||
}
|
||||
else if (char === ',') {
|
||||
if (foundComma) {
|
||||
return -1;
|
||||
}
|
||||
foundComma = true;
|
||||
}
|
||||
else if (char === '}') {
|
||||
return index;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
var TokenizerBlockMode;
|
||||
(function (TokenizerBlockMode) {
|
||||
TokenizerBlockMode[TokenizerBlockMode["Full"] = 0] = "Full";
|
||||
TokenizerBlockMode[TokenizerBlockMode["Character"] = 1] = "Character";
|
||||
})(TokenizerBlockMode || (exports.TokenizerBlockMode = TokenizerBlockMode = {}));
|
||||
function blockEndFrom(text, from, unicodeMode, mode) {
|
||||
switch (text[from]) {
|
||||
case '[': {
|
||||
if (mode === TokenizerBlockMode.Character) {
|
||||
return from + 1;
|
||||
}
|
||||
return squaredBracketBlockContentEndFrom(text, from + 1) + 1;
|
||||
}
|
||||
case '{': {
|
||||
if (mode === TokenizerBlockMode.Character) {
|
||||
return from + 1;
|
||||
}
|
||||
const foundEnd = curlyBracketBlockContentEndFrom(text, from + 1);
|
||||
if (foundEnd === -1) {
|
||||
return from + 1;
|
||||
}
|
||||
return foundEnd + 1;
|
||||
}
|
||||
case '(': {
|
||||
if (mode === TokenizerBlockMode.Character) {
|
||||
return from + 1;
|
||||
}
|
||||
return parenthesisBlockContentEndFrom(text, from + 1) + 1;
|
||||
}
|
||||
case ']':
|
||||
case '}':
|
||||
case ')':
|
||||
return from + 1;
|
||||
case '\\': {
|
||||
const next1 = text[from + 1];
|
||||
switch (next1) {
|
||||
case 'x':
|
||||
if (isHexaDigit(text[from + 2]) && isHexaDigit(text[from + 3])) {
|
||||
return from + 4;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 4)}' found`);
|
||||
case 'u':
|
||||
if (text[from + 2] === '{') {
|
||||
if (!unicodeMode) {
|
||||
return from + 2;
|
||||
}
|
||||
if (text[from + 4] === '}') {
|
||||
if (isHexaDigit(text[from + 3])) {
|
||||
return from + 5;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 5)}' found`);
|
||||
}
|
||||
if (text[from + 5] === '}') {
|
||||
if (isHexaDigit(text[from + 3]) && isHexaDigit(text[from + 4])) {
|
||||
return from + 6;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 6)}' found`);
|
||||
}
|
||||
if (text[from + 6] === '}') {
|
||||
if (isHexaDigit(text[from + 3]) && isHexaDigit(text[from + 4]) && isHexaDigit(text[from + 5])) {
|
||||
return from + 7;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 7)}' found`);
|
||||
}
|
||||
if (text[from + 7] === '}') {
|
||||
if (isHexaDigit(text[from + 3]) &&
|
||||
isHexaDigit(text[from + 4]) &&
|
||||
isHexaDigit(text[from + 5]) &&
|
||||
isHexaDigit(text[from + 6])) {
|
||||
return from + 8;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 8)}' found`);
|
||||
}
|
||||
if (text[from + 8] === '}' &&
|
||||
isHexaDigit(text[from + 3]) &&
|
||||
isHexaDigit(text[from + 4]) &&
|
||||
isHexaDigit(text[from + 5]) &&
|
||||
isHexaDigit(text[from + 6]) &&
|
||||
isHexaDigit(text[from + 7])) {
|
||||
return from + 9;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 9)}' found`);
|
||||
}
|
||||
if (isHexaDigit(text[from + 2]) &&
|
||||
isHexaDigit(text[from + 3]) &&
|
||||
isHexaDigit(text[from + 4]) &&
|
||||
isHexaDigit(text[from + 5])) {
|
||||
return from + 6;
|
||||
}
|
||||
throw new Error(`Unexpected token '${text.substring(from, from + 6)}' found`);
|
||||
case 'p':
|
||||
case 'P': {
|
||||
if (!unicodeMode) {
|
||||
return from + 2;
|
||||
}
|
||||
let subIndex = from + 2;
|
||||
for (; subIndex < text.length && text[subIndex] !== '}'; subIndex += text[subIndex] === '\\' ? 2 : 1) {
|
||||
}
|
||||
if (text[subIndex] !== '}') {
|
||||
throw new Error(`Invalid \\P definition`);
|
||||
}
|
||||
return subIndex + 1;
|
||||
}
|
||||
case 'k': {
|
||||
let subIndex = from + 2;
|
||||
for (; subIndex < text.length && text[subIndex] !== '>'; ++subIndex) {
|
||||
}
|
||||
if (text[subIndex] !== '>') {
|
||||
if (!unicodeMode) {
|
||||
return from + 2;
|
||||
}
|
||||
throw new Error(`Invalid \\k definition`);
|
||||
}
|
||||
return subIndex + 1;
|
||||
}
|
||||
default: {
|
||||
if (isDigit(next1)) {
|
||||
const maxIndex = unicodeMode ? text.length : Math.min(from + 4, text.length);
|
||||
let subIndex = from + 2;
|
||||
for (; subIndex < maxIndex && isDigit(text[subIndex]); ++subIndex) {
|
||||
}
|
||||
return subIndex;
|
||||
}
|
||||
const charSize = unicodeMode ? charSizeAt(text, from + 1) : 1;
|
||||
return from + charSize + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
const charSize = unicodeMode ? charSizeAt(text, from) : 1;
|
||||
return from + charSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
function readFrom(text, from, unicodeMode, mode) {
|
||||
const to = blockEndFrom(text, from, unicodeMode, mode);
|
||||
return text.substring(from, to);
|
||||
}
|
||||
38
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SameValueSet.js
generated
vendored
Normal file
38
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SameValueSet.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SameValueSet = void 0;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeObjectIs = Object.is;
|
||||
class SameValueSet {
|
||||
constructor(selector) {
|
||||
this.selector = selector;
|
||||
this.selectedItemsExceptMinusZero = new globals_1.Set();
|
||||
this.data = [];
|
||||
this.hasMinusZero = false;
|
||||
}
|
||||
tryAdd(value) {
|
||||
const selected = this.selector(value);
|
||||
if (safeObjectIs(selected, -0)) {
|
||||
if (this.hasMinusZero) {
|
||||
return false;
|
||||
}
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
this.hasMinusZero = true;
|
||||
return true;
|
||||
}
|
||||
const sizeBefore = this.selectedItemsExceptMinusZero.size;
|
||||
(0, globals_1.safeAdd)(this.selectedItemsExceptMinusZero, selected);
|
||||
if (sizeBefore !== this.selectedItemsExceptMinusZero.size) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
size() {
|
||||
return this.data.length;
|
||||
}
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
exports.SameValueSet = SameValueSet;
|
||||
28
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SameValueZeroSet.js
generated
vendored
Normal file
28
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SameValueZeroSet.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SameValueZeroSet = void 0;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
class SameValueZeroSet {
|
||||
constructor(selector) {
|
||||
this.selector = selector;
|
||||
this.selectedItems = new globals_1.Set();
|
||||
this.data = [];
|
||||
}
|
||||
tryAdd(value) {
|
||||
const selected = this.selector(value);
|
||||
const sizeBefore = this.selectedItems.size;
|
||||
(0, globals_1.safeAdd)(this.selectedItems, selected);
|
||||
if (sizeBefore !== this.selectedItems.size) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
size() {
|
||||
return this.data.length;
|
||||
}
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
exports.SameValueZeroSet = SameValueZeroSet;
|
||||
84
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SanitizeRegexAst.js
generated
vendored
Normal file
84
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SanitizeRegexAst.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addMissingDotStar = addMissingDotStar;
|
||||
const stringify_1 = require("../../../utils/stringify");
|
||||
function raiseUnsupportedASTNode(astNode) {
|
||||
return new Error(`Unsupported AST node! Received: ${(0, stringify_1.stringify)(astNode)}`);
|
||||
}
|
||||
function addMissingDotStarTraversalAddMissing(astNode, isFirst, isLast) {
|
||||
if (!isFirst && !isLast) {
|
||||
return astNode;
|
||||
}
|
||||
const traversalResults = { hasStart: false, hasEnd: false };
|
||||
const revampedNode = addMissingDotStarTraversal(astNode, isFirst, isLast, traversalResults);
|
||||
const missingStart = isFirst && !traversalResults.hasStart;
|
||||
const missingEnd = isLast && !traversalResults.hasEnd;
|
||||
if (!missingStart && !missingEnd) {
|
||||
return revampedNode;
|
||||
}
|
||||
const expressions = [];
|
||||
if (missingStart) {
|
||||
expressions.push({ type: 'Assertion', kind: '^' });
|
||||
expressions.push({
|
||||
type: 'Repetition',
|
||||
quantifier: { type: 'Quantifier', kind: '*', greedy: true },
|
||||
expression: { type: 'Char', kind: 'meta', symbol: '.', value: '.', codePoint: Number.NaN },
|
||||
});
|
||||
}
|
||||
expressions.push(revampedNode);
|
||||
if (missingEnd) {
|
||||
expressions.push({
|
||||
type: 'Repetition',
|
||||
quantifier: { type: 'Quantifier', kind: '*', greedy: true },
|
||||
expression: { type: 'Char', kind: 'meta', symbol: '.', value: '.', codePoint: Number.NaN },
|
||||
});
|
||||
expressions.push({ type: 'Assertion', kind: '$' });
|
||||
}
|
||||
return { type: 'Group', capturing: false, expression: { type: 'Alternative', expressions } };
|
||||
}
|
||||
function addMissingDotStarTraversal(astNode, isFirst, isLast, traversalResults) {
|
||||
switch (astNode.type) {
|
||||
case 'Char':
|
||||
return astNode;
|
||||
case 'Repetition':
|
||||
return astNode;
|
||||
case 'Quantifier':
|
||||
throw new Error(`Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!`);
|
||||
case 'Alternative':
|
||||
traversalResults.hasStart = true;
|
||||
traversalResults.hasEnd = true;
|
||||
return Object.assign(Object.assign({}, astNode), { expressions: astNode.expressions.map((node, index) => addMissingDotStarTraversalAddMissing(node, isFirst && index === 0, isLast && index === astNode.expressions.length - 1)) });
|
||||
case 'CharacterClass':
|
||||
return astNode;
|
||||
case 'ClassRange':
|
||||
return astNode;
|
||||
case 'Group': {
|
||||
return Object.assign(Object.assign({}, astNode), { expression: addMissingDotStarTraversal(astNode.expression, isFirst, isLast, traversalResults) });
|
||||
}
|
||||
case 'Disjunction': {
|
||||
traversalResults.hasStart = true;
|
||||
traversalResults.hasEnd = true;
|
||||
return Object.assign(Object.assign({}, astNode), { left: astNode.left !== null ? addMissingDotStarTraversalAddMissing(astNode.left, isFirst, isLast) : null, right: astNode.right !== null ? addMissingDotStarTraversalAddMissing(astNode.right, isFirst, isLast) : null });
|
||||
}
|
||||
case 'Assertion': {
|
||||
if (astNode.kind === '^' || astNode.kind === 'Lookahead') {
|
||||
traversalResults.hasStart = true;
|
||||
return astNode;
|
||||
}
|
||||
else if (astNode.kind === '$' || astNode.kind === 'Lookbehind') {
|
||||
traversalResults.hasEnd = true;
|
||||
return astNode;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Assertions of kind ${astNode.kind} not implemented yet!`);
|
||||
}
|
||||
}
|
||||
case 'Backreference':
|
||||
return astNode;
|
||||
default:
|
||||
throw raiseUnsupportedASTNode(astNode);
|
||||
}
|
||||
}
|
||||
function addMissingDotStar(astNode) {
|
||||
return addMissingDotStarTraversalAddMissing(astNode, true, true);
|
||||
}
|
||||
31
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ShrinkBigInt.js
generated
vendored
Normal file
31
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ShrinkBigInt.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.shrinkBigInt = shrinkBigInt;
|
||||
const Stream_1 = require("../../../stream/Stream");
|
||||
const Value_1 = require("../../../check/arbitrary/definition/Value");
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function halveBigInt(n) {
|
||||
return n / (0, globals_1.BigInt)(2);
|
||||
}
|
||||
function shrinkBigInt(current, target, tryTargetAsap) {
|
||||
const realGap = current - target;
|
||||
function* shrinkDecr() {
|
||||
let previous = tryTargetAsap ? undefined : target;
|
||||
const gap = tryTargetAsap ? realGap : halveBigInt(realGap);
|
||||
for (let toremove = gap; toremove > 0; toremove = halveBigInt(toremove)) {
|
||||
const next = current - toremove;
|
||||
yield new Value_1.Value(next, previous);
|
||||
previous = next;
|
||||
}
|
||||
}
|
||||
function* shrinkIncr() {
|
||||
let previous = tryTargetAsap ? undefined : target;
|
||||
const gap = tryTargetAsap ? realGap : halveBigInt(realGap);
|
||||
for (let toremove = gap; toremove < 0; toremove = halveBigInt(toremove)) {
|
||||
const next = current - toremove;
|
||||
yield new Value_1.Value(next, previous);
|
||||
previous = next;
|
||||
}
|
||||
}
|
||||
return realGap > 0 ? (0, Stream_1.stream)(shrinkDecr()) : (0, Stream_1.stream)(shrinkIncr());
|
||||
}
|
||||
35
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ShrinkInteger.js
generated
vendored
Normal file
35
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ShrinkInteger.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.shrinkInteger = shrinkInteger;
|
||||
const Value_1 = require("../../../check/arbitrary/definition/Value");
|
||||
const Stream_1 = require("../../../stream/Stream");
|
||||
const safeMathCeil = Math.ceil;
|
||||
const safeMathFloor = Math.floor;
|
||||
function halvePosInteger(n) {
|
||||
return safeMathFloor(n / 2);
|
||||
}
|
||||
function halveNegInteger(n) {
|
||||
return safeMathCeil(n / 2);
|
||||
}
|
||||
function shrinkInteger(current, target, tryTargetAsap) {
|
||||
const realGap = current - target;
|
||||
function* shrinkDecr() {
|
||||
let previous = tryTargetAsap ? undefined : target;
|
||||
const gap = tryTargetAsap ? realGap : halvePosInteger(realGap);
|
||||
for (let toremove = gap; toremove > 0; toremove = halvePosInteger(toremove)) {
|
||||
const next = toremove === realGap ? target : current - toremove;
|
||||
yield new Value_1.Value(next, previous);
|
||||
previous = next;
|
||||
}
|
||||
}
|
||||
function* shrinkIncr() {
|
||||
let previous = tryTargetAsap ? undefined : target;
|
||||
const gap = tryTargetAsap ? realGap : halveNegInteger(realGap);
|
||||
for (let toremove = gap; toremove < 0; toremove = halveNegInteger(toremove)) {
|
||||
const next = toremove === realGap ? target : current - toremove;
|
||||
yield new Value_1.Value(next, previous);
|
||||
previous = next;
|
||||
}
|
||||
}
|
||||
return realGap > 0 ? (0, Stream_1.stream)(shrinkDecr()) : (0, Stream_1.stream)(shrinkIncr());
|
||||
}
|
||||
82
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SlicesForStringBuilder.js
generated
vendored
Normal file
82
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/SlicesForStringBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createSlicesForStringLegacy = createSlicesForStringLegacy;
|
||||
exports.createSlicesForString = createSlicesForString;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const PatternsToString_1 = require("../mappers/PatternsToString");
|
||||
const MaxLengthFromMinLength_1 = require("./MaxLengthFromMinLength");
|
||||
const TokenizeString_1 = require("./TokenizeString");
|
||||
const dangerousStrings = [
|
||||
'__defineGetter__',
|
||||
'__defineSetter__',
|
||||
'__lookupGetter__',
|
||||
'__lookupSetter__',
|
||||
'__proto__',
|
||||
'constructor',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'toLocaleString',
|
||||
'toString',
|
||||
'valueOf',
|
||||
'apply',
|
||||
'arguments',
|
||||
'bind',
|
||||
'call',
|
||||
'caller',
|
||||
'length',
|
||||
'name',
|
||||
'prototype',
|
||||
'key',
|
||||
'ref',
|
||||
];
|
||||
function computeCandidateStringLegacy(dangerous, charArbitrary, stringSplitter) {
|
||||
let candidate;
|
||||
try {
|
||||
candidate = stringSplitter(dangerous);
|
||||
}
|
||||
catch (err) {
|
||||
return undefined;
|
||||
}
|
||||
for (const entry of candidate) {
|
||||
if (!charArbitrary.canShrinkWithoutContext(entry)) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
function createSlicesForStringLegacy(charArbitrary, stringSplitter) {
|
||||
const slicesForString = [];
|
||||
for (const dangerous of dangerousStrings) {
|
||||
const candidate = computeCandidateStringLegacy(dangerous, charArbitrary, stringSplitter);
|
||||
if (candidate !== undefined) {
|
||||
(0, globals_1.safePush)(slicesForString, candidate);
|
||||
}
|
||||
}
|
||||
return slicesForString;
|
||||
}
|
||||
const slicesPerArbitrary = new WeakMap();
|
||||
function createSlicesForStringNoConstraints(charArbitrary) {
|
||||
const slicesForString = [];
|
||||
for (const dangerous of dangerousStrings) {
|
||||
const candidate = (0, TokenizeString_1.tokenizeString)(charArbitrary, dangerous, 0, MaxLengthFromMinLength_1.MaxLengthUpperBound);
|
||||
if (candidate !== undefined) {
|
||||
(0, globals_1.safePush)(slicesForString, candidate);
|
||||
}
|
||||
}
|
||||
return slicesForString;
|
||||
}
|
||||
function createSlicesForString(charArbitrary, constraints) {
|
||||
let slices = (0, globals_1.safeGet)(slicesPerArbitrary, charArbitrary);
|
||||
if (slices === undefined) {
|
||||
slices = createSlicesForStringNoConstraints(charArbitrary);
|
||||
(0, globals_1.safeSet)(slicesPerArbitrary, charArbitrary, slices);
|
||||
}
|
||||
const slicesForConstraints = [];
|
||||
for (const slice of slices) {
|
||||
if ((0, PatternsToString_1.patternsToStringUnmapperIsValidLength)(slice, constraints)) {
|
||||
(0, globals_1.safePush)(slicesForConstraints, slice);
|
||||
}
|
||||
}
|
||||
return slicesForConstraints;
|
||||
}
|
||||
33
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/StrictlyEqualSet.js
generated
vendored
Normal file
33
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/StrictlyEqualSet.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StrictlyEqualSet = void 0;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const safeNumberIsNaN = Number.isNaN;
|
||||
class StrictlyEqualSet {
|
||||
constructor(selector) {
|
||||
this.selector = selector;
|
||||
this.selectedItemsExceptNaN = new globals_1.Set();
|
||||
this.data = [];
|
||||
}
|
||||
tryAdd(value) {
|
||||
const selected = this.selector(value);
|
||||
if (safeNumberIsNaN(selected)) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
const sizeBefore = this.selectedItemsExceptNaN.size;
|
||||
(0, globals_1.safeAdd)(this.selectedItemsExceptNaN, selected);
|
||||
if (sizeBefore !== this.selectedItemsExceptNaN.size) {
|
||||
(0, globals_1.safePush)(this.data, value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
size() {
|
||||
return this.data.length;
|
||||
}
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
exports.StrictlyEqualSet = StrictlyEqualSet;
|
||||
10
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TextEscaper.js
generated
vendored
Normal file
10
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TextEscaper.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.escapeForTemplateString = escapeForTemplateString;
|
||||
exports.escapeForMultilineComments = escapeForMultilineComments;
|
||||
function escapeForTemplateString(originalText) {
|
||||
return originalText.replace(/([$`\\])/g, '\\$1').replace(/\r/g, '\\r');
|
||||
}
|
||||
function escapeForMultilineComments(originalText) {
|
||||
return originalText.replace(/\*\//g, '*\\/');
|
||||
}
|
||||
53
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ToggleFlags.js
generated
vendored
Normal file
53
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ToggleFlags.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.countToggledBits = countToggledBits;
|
||||
exports.computeNextFlags = computeNextFlags;
|
||||
exports.computeTogglePositions = computeTogglePositions;
|
||||
exports.computeFlagsFromChars = computeFlagsFromChars;
|
||||
exports.applyFlagsOnChars = applyFlagsOnChars;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function countToggledBits(n) {
|
||||
let count = 0;
|
||||
while (n > (0, globals_1.BigInt)(0)) {
|
||||
if (n & (0, globals_1.BigInt)(1))
|
||||
++count;
|
||||
n >>= (0, globals_1.BigInt)(1);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
function computeNextFlags(flags, nextSize) {
|
||||
const allowedMask = ((0, globals_1.BigInt)(1) << (0, globals_1.BigInt)(nextSize)) - (0, globals_1.BigInt)(1);
|
||||
const preservedFlags = flags & allowedMask;
|
||||
let numMissingFlags = countToggledBits(flags - preservedFlags);
|
||||
let nFlags = preservedFlags;
|
||||
for (let mask = (0, globals_1.BigInt)(1); mask <= allowedMask && numMissingFlags !== 0; mask <<= (0, globals_1.BigInt)(1)) {
|
||||
if (!(nFlags & mask)) {
|
||||
nFlags |= mask;
|
||||
--numMissingFlags;
|
||||
}
|
||||
}
|
||||
return nFlags;
|
||||
}
|
||||
function computeTogglePositions(chars, toggleCase) {
|
||||
const positions = [];
|
||||
for (let idx = chars.length - 1; idx !== -1; --idx) {
|
||||
if (toggleCase(chars[idx]) !== chars[idx])
|
||||
(0, globals_1.safePush)(positions, idx);
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
function computeFlagsFromChars(untoggledChars, toggledChars, togglePositions) {
|
||||
let flags = (0, globals_1.BigInt)(0);
|
||||
for (let idx = 0, mask = (0, globals_1.BigInt)(1); idx !== togglePositions.length; ++idx, mask <<= (0, globals_1.BigInt)(1)) {
|
||||
if (untoggledChars[togglePositions[idx]] !== toggledChars[togglePositions[idx]]) {
|
||||
flags |= mask;
|
||||
}
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
function applyFlagsOnChars(chars, flags, togglePositions, toggleCase) {
|
||||
for (let idx = 0, mask = (0, globals_1.BigInt)(1); idx !== togglePositions.length; ++idx, mask <<= (0, globals_1.BigInt)(1)) {
|
||||
if (flags & mask)
|
||||
chars[togglePositions[idx]] = toggleCase(chars[togglePositions[idx]]);
|
||||
}
|
||||
}
|
||||
323
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TokenizeRegex.js
generated
vendored
Normal file
323
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TokenizeRegex.js
generated
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tokenizeRegex = tokenizeRegex;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
const ReadRegex_1 = require("./ReadRegex");
|
||||
const safeStringFromCodePoint = String.fromCodePoint;
|
||||
function safePop(tokens) {
|
||||
const previous = tokens.pop();
|
||||
if (previous === undefined) {
|
||||
throw new Error('Unable to extract token preceeding the currently parsed one');
|
||||
}
|
||||
return previous;
|
||||
}
|
||||
function isDigit(char) {
|
||||
return char >= '0' && char <= '9';
|
||||
}
|
||||
function simpleChar(char, escaped) {
|
||||
return {
|
||||
type: 'Char',
|
||||
kind: 'simple',
|
||||
symbol: char,
|
||||
value: char,
|
||||
codePoint: char.codePointAt(0) || -1,
|
||||
escaped,
|
||||
};
|
||||
}
|
||||
function metaEscapedChar(block, symbol) {
|
||||
return {
|
||||
type: 'Char',
|
||||
kind: 'meta',
|
||||
symbol,
|
||||
value: block,
|
||||
codePoint: symbol.codePointAt(0) || -1,
|
||||
};
|
||||
}
|
||||
function toSingleToken(tokens, allowEmpty) {
|
||||
if (tokens.length > 1) {
|
||||
return {
|
||||
type: 'Alternative',
|
||||
expressions: tokens,
|
||||
};
|
||||
}
|
||||
if (!allowEmpty && tokens.length === 0) {
|
||||
throw new Error(`Unsupported no token`);
|
||||
}
|
||||
return tokens[0];
|
||||
}
|
||||
function blockToCharToken(block) {
|
||||
if (block[0] === '\\') {
|
||||
const next = block[1];
|
||||
switch (next) {
|
||||
case 'x': {
|
||||
const allDigits = block.substring(2);
|
||||
const codePoint = Number.parseInt(allDigits, 16);
|
||||
const symbol = safeStringFromCodePoint(codePoint);
|
||||
return { type: 'Char', kind: 'hex', symbol, value: block, codePoint };
|
||||
}
|
||||
case 'u': {
|
||||
if (block === '\\u') {
|
||||
return simpleChar('u', true);
|
||||
}
|
||||
const allDigits = block[2] === '{' ? block.substring(3, block.length - 1) : block.substring(2);
|
||||
const codePoint = Number.parseInt(allDigits, 16);
|
||||
const symbol = safeStringFromCodePoint(codePoint);
|
||||
return { type: 'Char', kind: 'unicode', symbol, value: block, codePoint };
|
||||
}
|
||||
case '0': {
|
||||
return metaEscapedChar(block, '\0');
|
||||
}
|
||||
case 'n': {
|
||||
return metaEscapedChar(block, '\n');
|
||||
}
|
||||
case 'f': {
|
||||
return metaEscapedChar(block, '\f');
|
||||
}
|
||||
case 'r': {
|
||||
return metaEscapedChar(block, '\r');
|
||||
}
|
||||
case 't': {
|
||||
return metaEscapedChar(block, '\t');
|
||||
}
|
||||
case 'v': {
|
||||
return metaEscapedChar(block, '\v');
|
||||
}
|
||||
case 'w':
|
||||
case 'W':
|
||||
case 'd':
|
||||
case 'D':
|
||||
case 's':
|
||||
case 'S':
|
||||
case 'b':
|
||||
case 'B': {
|
||||
return { type: 'Char', kind: 'meta', symbol: undefined, value: block, codePoint: Number.NaN };
|
||||
}
|
||||
default: {
|
||||
if (isDigit(next)) {
|
||||
const allDigits = block.substring(1);
|
||||
const codePoint = Number(allDigits);
|
||||
const symbol = safeStringFromCodePoint(codePoint);
|
||||
return { type: 'Char', kind: 'decimal', symbol, value: block, codePoint };
|
||||
}
|
||||
if (block.length > 2 && (next === 'p' || next === 'P')) {
|
||||
throw new Error(`UnicodeProperty not implemented yet!`);
|
||||
}
|
||||
const char = block.substring(1);
|
||||
return simpleChar(char, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return simpleChar(block);
|
||||
}
|
||||
function pushTokens(tokens, regexSource, unicodeMode, groups) {
|
||||
let disjunctions = null;
|
||||
for (let index = 0, block = (0, ReadRegex_1.readFrom)(regexSource, index, unicodeMode, ReadRegex_1.TokenizerBlockMode.Full); index !== regexSource.length; index += block.length, block = (0, ReadRegex_1.readFrom)(regexSource, index, unicodeMode, ReadRegex_1.TokenizerBlockMode.Full)) {
|
||||
const firstInBlock = block[0];
|
||||
switch (firstInBlock) {
|
||||
case '|': {
|
||||
if (disjunctions === null) {
|
||||
disjunctions = [];
|
||||
}
|
||||
disjunctions.push(toSingleToken(tokens.splice(0), true) || null);
|
||||
break;
|
||||
}
|
||||
case '.': {
|
||||
tokens.push({ type: 'Char', kind: 'meta', symbol: block, value: block, codePoint: Number.NaN });
|
||||
break;
|
||||
}
|
||||
case '*':
|
||||
case '+': {
|
||||
const previous = safePop(tokens);
|
||||
tokens.push({
|
||||
type: 'Repetition',
|
||||
expression: previous,
|
||||
quantifier: { type: 'Quantifier', kind: firstInBlock, greedy: true },
|
||||
});
|
||||
break;
|
||||
}
|
||||
case '?': {
|
||||
const previous = safePop(tokens);
|
||||
if (previous.type === 'Repetition') {
|
||||
previous.quantifier.greedy = false;
|
||||
tokens.push(previous);
|
||||
}
|
||||
else {
|
||||
tokens.push({
|
||||
type: 'Repetition',
|
||||
expression: previous,
|
||||
quantifier: { type: 'Quantifier', kind: firstInBlock, greedy: true },
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '{': {
|
||||
if (block === '{') {
|
||||
tokens.push(simpleChar(block));
|
||||
break;
|
||||
}
|
||||
const previous = safePop(tokens);
|
||||
const quantifierText = block.substring(1, block.length - 1);
|
||||
const quantifierTokens = quantifierText.split(',');
|
||||
const from = Number(quantifierTokens[0]);
|
||||
const to = quantifierTokens.length === 1
|
||||
? from
|
||||
: quantifierTokens[1].length !== 0
|
||||
? Number(quantifierTokens[1])
|
||||
: undefined;
|
||||
tokens.push({
|
||||
type: 'Repetition',
|
||||
expression: previous,
|
||||
quantifier: { type: 'Quantifier', kind: 'Range', greedy: true, from, to },
|
||||
});
|
||||
break;
|
||||
}
|
||||
case '[': {
|
||||
const blockContent = block.substring(1, block.length - 1);
|
||||
const subTokens = [];
|
||||
let negative = undefined;
|
||||
let previousWasSimpleDash = false;
|
||||
for (let subIndex = 0, subBlock = (0, ReadRegex_1.readFrom)(blockContent, subIndex, unicodeMode, ReadRegex_1.TokenizerBlockMode.Character); subIndex !== blockContent.length; subIndex += subBlock.length,
|
||||
subBlock = (0, ReadRegex_1.readFrom)(blockContent, subIndex, unicodeMode, ReadRegex_1.TokenizerBlockMode.Character)) {
|
||||
if (subIndex === 0 && subBlock === '^') {
|
||||
negative = true;
|
||||
continue;
|
||||
}
|
||||
const newToken = blockToCharToken(subBlock);
|
||||
if (subBlock === '-') {
|
||||
subTokens.push(newToken);
|
||||
previousWasSimpleDash = true;
|
||||
}
|
||||
else {
|
||||
const operand1Token = subTokens.length >= 2 ? subTokens[subTokens.length - 2] : undefined;
|
||||
if (previousWasSimpleDash && operand1Token !== undefined && operand1Token.type === 'Char') {
|
||||
subTokens.pop();
|
||||
subTokens.pop();
|
||||
subTokens.push({ type: 'ClassRange', from: operand1Token, to: newToken });
|
||||
}
|
||||
else {
|
||||
subTokens.push(newToken);
|
||||
}
|
||||
previousWasSimpleDash = false;
|
||||
}
|
||||
}
|
||||
tokens.push({ type: 'CharacterClass', expressions: subTokens, negative });
|
||||
break;
|
||||
}
|
||||
case '(': {
|
||||
const blockContent = block.substring(1, block.length - 1);
|
||||
const subTokens = [];
|
||||
if (blockContent[0] === '?') {
|
||||
if (blockContent[1] === ':') {
|
||||
pushTokens(subTokens, blockContent.substring(2), unicodeMode, groups);
|
||||
tokens.push({
|
||||
type: 'Group',
|
||||
capturing: false,
|
||||
expression: toSingleToken(subTokens),
|
||||
});
|
||||
}
|
||||
else if (blockContent[1] === '=' || blockContent[1] === '!') {
|
||||
pushTokens(subTokens, blockContent.substring(2), unicodeMode, groups);
|
||||
tokens.push({
|
||||
type: 'Assertion',
|
||||
kind: 'Lookahead',
|
||||
negative: blockContent[1] === '!' ? true : undefined,
|
||||
assertion: toSingleToken(subTokens),
|
||||
});
|
||||
}
|
||||
else if (blockContent[1] === '<' && (blockContent[2] === '=' || blockContent[2] === '!')) {
|
||||
pushTokens(subTokens, blockContent.substring(3), unicodeMode, groups);
|
||||
tokens.push({
|
||||
type: 'Assertion',
|
||||
kind: 'Lookbehind',
|
||||
negative: blockContent[2] === '!' ? true : undefined,
|
||||
assertion: toSingleToken(subTokens),
|
||||
});
|
||||
}
|
||||
else {
|
||||
const chunks = blockContent.split('>');
|
||||
if (chunks.length < 2 || chunks[0][1] !== '<') {
|
||||
throw new Error(`Unsupported regex content found at ${JSON.stringify(block)}`);
|
||||
}
|
||||
const groupIndex = ++groups.lastIndex;
|
||||
const nameRaw = chunks[0].substring(2);
|
||||
groups.named.set(nameRaw, groupIndex);
|
||||
pushTokens(subTokens, chunks.slice(1).join('>'), unicodeMode, groups);
|
||||
tokens.push({
|
||||
type: 'Group',
|
||||
capturing: true,
|
||||
nameRaw,
|
||||
name: nameRaw,
|
||||
number: groupIndex,
|
||||
expression: toSingleToken(subTokens),
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
const groupIndex = ++groups.lastIndex;
|
||||
pushTokens(subTokens, blockContent, unicodeMode, groups);
|
||||
tokens.push({
|
||||
type: 'Group',
|
||||
capturing: true,
|
||||
number: groupIndex,
|
||||
expression: toSingleToken(subTokens),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (block === '^') {
|
||||
tokens.push({ type: 'Assertion', kind: block });
|
||||
}
|
||||
else if (block === '$') {
|
||||
tokens.push({ type: 'Assertion', kind: block });
|
||||
}
|
||||
else if (block[0] === '\\' && isDigit(block[1])) {
|
||||
const reference = Number(block.substring(1));
|
||||
if (unicodeMode || reference <= groups.lastIndex) {
|
||||
tokens.push({ type: 'Backreference', kind: 'number', number: reference, reference });
|
||||
}
|
||||
else {
|
||||
tokens.push(blockToCharToken(block));
|
||||
}
|
||||
}
|
||||
else if (block[0] === '\\' && block[1] === 'k' && block.length !== 2) {
|
||||
const referenceRaw = block.substring(3, block.length - 1);
|
||||
tokens.push({
|
||||
type: 'Backreference',
|
||||
kind: 'name',
|
||||
number: groups.named.get(referenceRaw) || 0,
|
||||
referenceRaw,
|
||||
reference: referenceRaw,
|
||||
});
|
||||
}
|
||||
else {
|
||||
tokens.push(blockToCharToken(block));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (disjunctions !== null) {
|
||||
disjunctions.push(toSingleToken(tokens.splice(0), true) || null);
|
||||
let currentDisjunction = {
|
||||
type: 'Disjunction',
|
||||
left: disjunctions[0],
|
||||
right: disjunctions[1],
|
||||
};
|
||||
for (let index = 2; index < disjunctions.length; ++index) {
|
||||
currentDisjunction = {
|
||||
type: 'Disjunction',
|
||||
left: currentDisjunction,
|
||||
right: disjunctions[index],
|
||||
};
|
||||
}
|
||||
tokens.push(currentDisjunction);
|
||||
}
|
||||
}
|
||||
function tokenizeRegex(regex) {
|
||||
const unicodeMode = (0, globals_1.safeIndexOf)([...regex.flags], 'u') !== -1;
|
||||
const regexSource = regex.source;
|
||||
const tokens = [];
|
||||
pushTokens(tokens, regexSource, unicodeMode, { lastIndex: 0, named: new Map() });
|
||||
return toSingleToken(tokens);
|
||||
}
|
||||
37
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TokenizeString.js
generated
vendored
Normal file
37
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/TokenizeString.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tokenizeString = tokenizeString;
|
||||
const globals_1 = require("../../../utils/globals");
|
||||
function tokenizeString(patternsArb, value, minLength, maxLength) {
|
||||
if (value.length === 0) {
|
||||
if (minLength > 0) {
|
||||
return undefined;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if (maxLength <= 0) {
|
||||
return undefined;
|
||||
}
|
||||
const stack = [{ endIndexChunks: 0, nextStartIndex: 1, chunks: [] }];
|
||||
while (stack.length > 0) {
|
||||
const last = (0, globals_1.safePop)(stack);
|
||||
for (let index = last.nextStartIndex; index <= value.length; ++index) {
|
||||
const chunk = (0, globals_1.safeSubstring)(value, last.endIndexChunks, index);
|
||||
if (patternsArb.canShrinkWithoutContext(chunk)) {
|
||||
const newChunks = [...last.chunks, chunk];
|
||||
if (index === value.length) {
|
||||
if (newChunks.length < minLength) {
|
||||
break;
|
||||
}
|
||||
return newChunks;
|
||||
}
|
||||
(0, globals_1.safePush)(stack, { endIndexChunks: last.endIndexChunks, nextStartIndex: index + 1, chunks: last.chunks });
|
||||
if (newChunks.length < maxLength) {
|
||||
(0, globals_1.safePush)(stack, { endIndexChunks: index, nextStartIndex: index + 1, chunks: newChunks });
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
30
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ZipIterableIterators.js
generated
vendored
Normal file
30
backend/node_modules/fast-check/lib/arbitrary/_internals/helpers/ZipIterableIterators.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.zipIterableIterators = zipIterableIterators;
|
||||
function initZippedValues(its) {
|
||||
const vs = [];
|
||||
for (let index = 0; index !== its.length; ++index) {
|
||||
vs.push(its[index].next());
|
||||
}
|
||||
return vs;
|
||||
}
|
||||
function nextZippedValues(its, vs) {
|
||||
for (let index = 0; index !== its.length; ++index) {
|
||||
vs[index] = its[index].next();
|
||||
}
|
||||
}
|
||||
function isDoneZippedValues(vs) {
|
||||
for (let index = 0; index !== vs.length; ++index) {
|
||||
if (vs[index].done) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function* zipIterableIterators(...its) {
|
||||
const vs = initZippedValues(its);
|
||||
while (!isDoneZippedValues(vs)) {
|
||||
yield vs.map((v) => v.value);
|
||||
nextZippedValues(its, vs);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user