Erster Docker-Stand

This commit is contained in:
Ali
2026-02-20 16:06:40 +09:00
commit f31e2e8ed3
8818 changed files with 1605323 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.anyArbitraryBuilder = anyArbitraryBuilder;
const stringify_1 = require("../../../utils/stringify");
const array_1 = require("../../array");
const oneof_1 = require("../../oneof");
const tuple_1 = require("../../tuple");
const bigInt_1 = require("../../bigInt");
const date_1 = require("../../date");
const float32Array_1 = require("../../float32Array");
const float64Array_1 = require("../../float64Array");
const int16Array_1 = require("../../int16Array");
const int32Array_1 = require("../../int32Array");
const int8Array_1 = require("../../int8Array");
const uint16Array_1 = require("../../uint16Array");
const uint32Array_1 = require("../../uint32Array");
const uint8Array_1 = require("../../uint8Array");
const uint8ClampedArray_1 = require("../../uint8ClampedArray");
const sparseArray_1 = require("../../sparseArray");
const ArrayToMap_1 = require("../mappers/ArrayToMap");
const ArrayToSet_1 = require("../mappers/ArrayToSet");
const letrec_1 = require("../../letrec");
const uniqueArray_1 = require("../../uniqueArray");
const DepthContext_1 = require("../helpers/DepthContext");
const dictionary_1 = require("../../dictionary");
function mapOf(ka, va, maxKeys, size, depthIdentifier) {
return (0, uniqueArray_1.uniqueArray)((0, tuple_1.tuple)(ka, va), {
maxLength: maxKeys,
size,
comparator: 'SameValueZero',
selector: (t) => t[0],
depthIdentifier,
}).map(ArrayToMap_1.arrayToMapMapper, ArrayToMap_1.arrayToMapUnmapper);
}
function dictOf(ka, va, maxKeys, size, depthIdentifier, withNullPrototype) {
return (0, dictionary_1.dictionary)(ka, va, {
maxKeys,
noNullPrototype: !withNullPrototype,
size,
depthIdentifier,
});
}
function setOf(va, maxKeys, size, depthIdentifier) {
return (0, uniqueArray_1.uniqueArray)(va, { maxLength: maxKeys, size, comparator: 'SameValueZero', depthIdentifier }).map(ArrayToSet_1.arrayToSetMapper, ArrayToSet_1.arrayToSetUnmapper);
}
function typedArray(constraints) {
return (0, oneof_1.oneof)((0, int8Array_1.int8Array)(constraints), (0, uint8Array_1.uint8Array)(constraints), (0, uint8ClampedArray_1.uint8ClampedArray)(constraints), (0, int16Array_1.int16Array)(constraints), (0, uint16Array_1.uint16Array)(constraints), (0, int32Array_1.int32Array)(constraints), (0, uint32Array_1.uint32Array)(constraints), (0, float32Array_1.float32Array)(constraints), (0, float64Array_1.float64Array)(constraints));
}
function anyArbitraryBuilder(constraints) {
const arbitrariesForBase = constraints.values;
const depthSize = constraints.depthSize;
const depthIdentifier = (0, DepthContext_1.createDepthIdentifier)();
const maxDepth = constraints.maxDepth;
const maxKeys = constraints.maxKeys;
const size = constraints.size;
const baseArb = (0, oneof_1.oneof)(...arbitrariesForBase, ...(constraints.withBigInt ? [(0, bigInt_1.bigInt)()] : []), ...(constraints.withDate ? [(0, date_1.date)()] : []));
return (0, letrec_1.letrec)((tie) => ({
anything: (0, oneof_1.oneof)({ maxDepth, depthSize, depthIdentifier }, baseArb, tie('array'), tie('object'), ...(constraints.withMap ? [tie('map')] : []), ...(constraints.withSet ? [tie('set')] : []), ...(constraints.withObjectString ? [tie('anything').map((o) => (0, stringify_1.stringify)(o))] : []), ...(constraints.withTypedArray ? [typedArray({ maxLength: maxKeys, size })] : []), ...(constraints.withSparseArray
? [(0, sparseArray_1.sparseArray)(tie('anything'), { maxNumElements: maxKeys, size, depthIdentifier })]
: [])),
keys: constraints.withObjectString
? (0, oneof_1.oneof)({ arbitrary: constraints.key, weight: 10 }, { arbitrary: tie('anything').map((o) => (0, stringify_1.stringify)(o)), weight: 1 })
: constraints.key,
array: (0, array_1.array)(tie('anything'), { maxLength: maxKeys, size, depthIdentifier }),
set: setOf(tie('anything'), maxKeys, size, depthIdentifier),
map: (0, oneof_1.oneof)(mapOf(tie('keys'), tie('anything'), maxKeys, size, depthIdentifier), mapOf(tie('anything'), tie('anything'), maxKeys, size, depthIdentifier)),
object: dictOf(tie('keys'), tie('anything'), maxKeys, size, depthIdentifier, constraints.withNullPrototype),
})).anything;
}

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.boxedArbitraryBuilder = boxedArbitraryBuilder;
const UnboxedToBoxed_1 = require("../mappers/UnboxedToBoxed");
function boxedArbitraryBuilder(arb) {
return arb.map(UnboxedToBoxed_1.unboxedToBoxedMapper, UnboxedToBoxed_1.unboxedToBoxedUnmapper);
}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildCharacterArbitrary = buildCharacterArbitrary;
const integer_1 = require("../../integer");
const IndexToCharString_1 = require("../mappers/IndexToCharString");
function buildCharacterArbitrary(min, max, mapToCode, unmapFromCode) {
return (0, integer_1.integer)({ min, max }).map((n) => (0, IndexToCharString_1.indexToCharStringMapper)(mapToCode(n)), (c) => unmapFromCode((0, IndexToCharString_1.indexToCharStringUnmapper)(c)));
}

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOrCreateLowerAlphaArbitrary = getOrCreateLowerAlphaArbitrary;
exports.getOrCreateLowerAlphaNumericArbitrary = getOrCreateLowerAlphaNumericArbitrary;
exports.getOrCreateAlphaNumericPercentArbitrary = getOrCreateAlphaNumericPercentArbitrary;
const fullUnicode_1 = require("../../fullUnicode");
const oneof_1 = require("../../oneof");
const mapToConstant_1 = require("../../mapToConstant");
const globals_1 = require("../../../utils/globals");
const SMap = Map;
const safeStringFromCharCode = String.fromCharCode;
const lowerCaseMapper = { num: 26, build: (v) => safeStringFromCharCode(v + 0x61) };
const upperCaseMapper = { num: 26, build: (v) => safeStringFromCharCode(v + 0x41) };
const numericMapper = { num: 10, build: (v) => safeStringFromCharCode(v + 0x30) };
function percentCharArbMapper(c) {
const encoded = (0, globals_1.encodeURIComponent)(c);
return c !== encoded ? encoded : `%${(0, globals_1.safeNumberToString)((0, globals_1.safeCharCodeAt)(c, 0), 16)}`;
}
function percentCharArbUnmapper(value) {
if (typeof value !== 'string') {
throw new Error('Unsupported');
}
const decoded = decodeURIComponent(value);
return decoded;
}
const percentCharArb = (0, fullUnicode_1.fullUnicode)().map(percentCharArbMapper, percentCharArbUnmapper);
let lowerAlphaArbitrary = undefined;
function getOrCreateLowerAlphaArbitrary() {
if (lowerAlphaArbitrary === undefined) {
lowerAlphaArbitrary = (0, mapToConstant_1.mapToConstant)(lowerCaseMapper);
}
return lowerAlphaArbitrary;
}
let lowerAlphaNumericArbitraries = undefined;
function getOrCreateLowerAlphaNumericArbitrary(others) {
if (lowerAlphaNumericArbitraries === undefined) {
lowerAlphaNumericArbitraries = new SMap();
}
let match = (0, globals_1.safeMapGet)(lowerAlphaNumericArbitraries, others);
if (match === undefined) {
match = (0, mapToConstant_1.mapToConstant)(lowerCaseMapper, numericMapper, {
num: others.length,
build: (v) => others[v],
});
(0, globals_1.safeMapSet)(lowerAlphaNumericArbitraries, others, match);
}
return match;
}
function buildAlphaNumericArbitrary(others) {
return (0, mapToConstant_1.mapToConstant)(lowerCaseMapper, upperCaseMapper, numericMapper, {
num: others.length,
build: (v) => others[v],
});
}
let alphaNumericPercentArbitraries = undefined;
function getOrCreateAlphaNumericPercentArbitrary(others) {
if (alphaNumericPercentArbitraries === undefined) {
alphaNumericPercentArbitraries = new SMap();
}
let match = (0, globals_1.safeMapGet)(alphaNumericPercentArbitraries, others);
if (match === undefined) {
match = (0, oneof_1.oneof)({ weight: 10, arbitrary: buildAlphaNumericArbitrary(others) }, { weight: 1, arbitrary: percentCharArb });
(0, globals_1.safeMapSet)(alphaNumericPercentArbitraries, others, match);
}
return match;
}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildCompareFunctionArbitrary = buildCompareFunctionArbitrary;
const TextEscaper_1 = require("../helpers/TextEscaper");
const symbols_1 = require("../../../check/symbols");
const hash_1 = require("../../../utils/hash");
const stringify_1 = require("../../../utils/stringify");
const integer_1 = require("../../integer");
const noShrink_1 = require("../../noShrink");
const tuple_1 = require("../../tuple");
const globals_1 = require("../../../utils/globals");
const safeObjectAssign = Object.assign;
const safeObjectKeys = Object.keys;
function buildCompareFunctionArbitrary(cmp) {
return (0, tuple_1.tuple)((0, noShrink_1.noShrink)((0, integer_1.integer)()), (0, noShrink_1.noShrink)((0, integer_1.integer)({ min: 1, max: 0xffffffff }))).map(([seed, hashEnvSize]) => {
const producer = () => {
const recorded = {};
const f = (a, b) => {
const reprA = (0, stringify_1.stringify)(a);
const reprB = (0, stringify_1.stringify)(b);
const hA = (0, hash_1.hash)(`${seed}${reprA}`) % hashEnvSize;
const hB = (0, hash_1.hash)(`${seed}${reprB}`) % hashEnvSize;
const val = cmp(hA, hB);
recorded[`[${reprA},${reprB}]`] = val;
return val;
};
return safeObjectAssign(f, {
toString: () => {
const seenValues = safeObjectKeys(recorded)
.sort()
.map((k) => `${k} => ${(0, stringify_1.stringify)(recorded[k])}`)
.map((line) => `/* ${(0, TextEscaper_1.escapeForMultilineComments)(line)} */`);
return `function(a, b) {
// With hash and stringify coming from fast-check${seenValues.length !== 0 ? `\n ${(0, globals_1.safeJoin)(seenValues, '\n ')}` : ''}
const cmp = ${cmp};
const hA = hash('${seed}' + stringify(a)) % ${hashEnvSize};
const hB = hash('${seed}' + stringify(b)) % ${hashEnvSize};
return cmp(hA, hB);
}`;
},
[symbols_1.cloneMethod]: producer,
});
};
return producer();
});
}

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildGeneratorValue = buildGeneratorValue;
const Value_1 = require("../../../check/arbitrary/definition/Value");
const symbols_1 = require("../../../check/symbols");
const globals_1 = require("../../../utils/globals");
const stringify_1 = require("../../../utils/stringify");
const safeObjectAssign = Object.assign;
function buildGeneratorValue(mrng, biasFactor, computePreBuiltValues, arbitraryCache) {
const preBuiltValues = computePreBuiltValues();
let localMrng = mrng.clone();
const context = { mrng: mrng.clone(), biasFactor, history: [] };
const valueFunction = (arb) => {
const preBuiltValue = preBuiltValues[context.history.length];
if (preBuiltValue !== undefined && preBuiltValue.arb === arb) {
const value = preBuiltValue.value;
(0, globals_1.safePush)(context.history, { arb, value, context: preBuiltValue.context, mrng: preBuiltValue.mrng });
localMrng = preBuiltValue.mrng.clone();
return value;
}
const g = arb.generate(localMrng, biasFactor);
(0, globals_1.safePush)(context.history, { arb, value: g.value_, context: g.context, mrng: localMrng.clone() });
return g.value;
};
const memoedValueFunction = (arb, ...args) => {
return valueFunction(arbitraryCache(arb, args));
};
const valueMethods = {
values() {
return (0, globals_1.safeMap)(context.history, (c) => c.value);
},
[symbols_1.cloneMethod]() {
return buildGeneratorValue(mrng, biasFactor, computePreBuiltValues, arbitraryCache).value;
},
[stringify_1.toStringMethod]() {
return (0, stringify_1.stringify)((0, globals_1.safeMap)(context.history, (c) => c.value));
},
};
const value = safeObjectAssign(memoedValueFunction, valueMethods);
return new Value_1.Value(value, context);
}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildPaddedNumberArbitrary = buildPaddedNumberArbitrary;
const integer_1 = require("../../integer");
const NumberToPaddedEight_1 = require("../mappers/NumberToPaddedEight");
function buildPaddedNumberArbitrary(min, max) {
return (0, integer_1.integer)({ min, max }).map(NumberToPaddedEight_1.numberToPaddedEightMapper, NumberToPaddedEight_1.numberToPaddedEightUnmapper);
}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildPartialRecordArbitrary = buildPartialRecordArbitrary;
const globals_1 = require("../../../utils/globals");
const boolean_1 = require("../../boolean");
const constant_1 = require("../../constant");
const option_1 = require("../../option");
const tuple_1 = require("../../tuple");
const EnumerableKeysExtractor_1 = require("../helpers/EnumerableKeysExtractor");
const ValuesAndSeparateKeysToObject_1 = require("../mappers/ValuesAndSeparateKeysToObject");
const noKeyValue = Symbol('no-key');
function buildPartialRecordArbitrary(recordModel, requiredKeys, noNullPrototype) {
const keys = (0, EnumerableKeysExtractor_1.extractEnumerableKeys)(recordModel);
const arbs = [];
for (let index = 0; index !== keys.length; ++index) {
const k = keys[index];
const requiredArbitrary = recordModel[k];
if (requiredKeys === undefined || (0, globals_1.safeIndexOf)(requiredKeys, k) !== -1) {
(0, globals_1.safePush)(arbs, requiredArbitrary);
}
else {
(0, globals_1.safePush)(arbs, (0, option_1.option)(requiredArbitrary, { nil: noKeyValue }));
}
}
return (0, tuple_1.tuple)((0, tuple_1.tuple)(...arbs), noNullPrototype ? (0, constant_1.constant)(false) : (0, boolean_1.boolean)()).map((0, ValuesAndSeparateKeysToObject_1.buildValuesAndSeparateKeysToObjectMapper)(keys, noKeyValue), (0, ValuesAndSeparateKeysToObject_1.buildValuesAndSeparateKeysToObjectUnmapper)(keys, noKeyValue));
}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.restrictedIntegerArbitraryBuilder = restrictedIntegerArbitraryBuilder;
const integer_1 = require("../../integer");
const WithShrinkFromOtherArbitrary_1 = require("../WithShrinkFromOtherArbitrary");
function restrictedIntegerArbitraryBuilder(min, maxGenerated, max) {
const generatorArbitrary = (0, integer_1.integer)({ min, max: maxGenerated });
if (maxGenerated === max) {
return generatorArbitrary;
}
const shrinkerArbitrary = (0, integer_1.integer)({ min, max });
return new WithShrinkFromOtherArbitrary_1.WithShrinkFromOtherArbitrary(generatorArbitrary, shrinkerArbitrary);
}

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildStableArbitraryGeneratorCache = buildStableArbitraryGeneratorCache;
exports.naiveIsEqual = naiveIsEqual;
const globals_1 = require("../../../utils/globals");
const safeArrayIsArray = Array.isArray;
const safeObjectKeys = Object.keys;
const safeObjectIs = Object.is;
function buildStableArbitraryGeneratorCache(isEqual) {
const previousCallsPerBuilder = new globals_1.Map();
return function stableArbitraryGeneratorCache(builder, args) {
const entriesForBuilder = (0, globals_1.safeMapGet)(previousCallsPerBuilder, builder);
if (entriesForBuilder === undefined) {
const newValue = builder(...args);
(0, globals_1.safeMapSet)(previousCallsPerBuilder, builder, [{ args, value: newValue }]);
return newValue;
}
const safeEntriesForBuilder = entriesForBuilder;
for (const entry of safeEntriesForBuilder) {
if (isEqual(args, entry.args)) {
return entry.value;
}
}
const newValue = builder(...args);
(0, globals_1.safePush)(safeEntriesForBuilder, { args, value: newValue });
return newValue;
};
}
function naiveIsEqual(v1, v2) {
if (v1 !== null && typeof v1 === 'object' && v2 !== null && typeof v2 === 'object') {
if (safeArrayIsArray(v1)) {
if (!safeArrayIsArray(v2))
return false;
if (v1.length !== v2.length)
return false;
}
else if (safeArrayIsArray(v2)) {
return false;
}
if (safeObjectKeys(v1).length !== safeObjectKeys(v2).length) {
return false;
}
for (const index in v1) {
if (!(index in v2)) {
return false;
}
if (!naiveIsEqual(v1[index], v2[index])) {
return false;
}
}
return true;
}
else {
return safeObjectIs(v1, v2);
}
}

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildStringifiedNatArbitrary = buildStringifiedNatArbitrary;
const constantFrom_1 = require("../../constantFrom");
const nat_1 = require("../../nat");
const tuple_1 = require("../../tuple");
const NatToStringifiedNat_1 = require("../mappers/NatToStringifiedNat");
function buildStringifiedNatArbitrary(maxValue) {
return (0, tuple_1.tuple)((0, constantFrom_1.constantFrom)('dec', 'oct', 'hex'), (0, nat_1.nat)(maxValue)).map(NatToStringifiedNat_1.natToStringifiedNatMapper, NatToStringifiedNat_1.natToStringifiedNatUnmapper);
}

View File

@@ -0,0 +1,33 @@
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.typedIntArrayArbitraryArbitraryBuilder = typedIntArrayArbitraryArbitraryBuilder;
const array_1 = require("../../array");
function typedIntArrayArbitraryArbitraryBuilder(constraints, defaultMin, defaultMax, TypedArrayClass, arbitraryBuilder) {
const generatorName = TypedArrayClass.name;
const { min = defaultMin, max = defaultMax } = constraints, arrayConstraints = __rest(constraints, ["min", "max"]);
if (min > max) {
throw new Error(`Invalid range passed to ${generatorName}: min must be lower than or equal to max`);
}
if (min < defaultMin) {
throw new Error(`Invalid min value passed to ${generatorName}: min must be greater than or equal to ${defaultMin}`);
}
if (max > defaultMax) {
throw new Error(`Invalid max value passed to ${generatorName}: max must be lower than or equal to ${defaultMax}`);
}
return (0, array_1.array)(arbitraryBuilder({ min, max }), arrayConstraints).map((data) => TypedArrayClass.from(data), (value) => {
if (!(value instanceof TypedArrayClass))
throw new Error('Invalid type');
return [...value];
});
}

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildUriPathArbitrary = buildUriPathArbitrary;
const webSegment_1 = require("../../webSegment");
const array_1 = require("../../array");
const SegmentsToPath_1 = require("../mappers/SegmentsToPath");
const oneof_1 = require("../../oneof");
function sqrtSize(size) {
switch (size) {
case 'xsmall':
return ['xsmall', 'xsmall'];
case 'small':
return ['small', 'xsmall'];
case 'medium':
return ['small', 'small'];
case 'large':
return ['medium', 'small'];
case 'xlarge':
return ['medium', 'medium'];
}
}
function buildUriPathArbitraryInternal(segmentSize, numSegmentSize) {
return (0, array_1.array)((0, webSegment_1.webSegment)({ size: segmentSize }), { size: numSegmentSize }).map(SegmentsToPath_1.segmentsToPathMapper, SegmentsToPath_1.segmentsToPathUnmapper);
}
function buildUriPathArbitrary(resolvedSize) {
const [segmentSize, numSegmentSize] = sqrtSize(resolvedSize);
if (segmentSize === numSegmentSize) {
return buildUriPathArbitraryInternal(segmentSize, numSegmentSize);
}
return (0, oneof_1.oneof)(buildUriPathArbitraryInternal(segmentSize, numSegmentSize), buildUriPathArbitraryInternal(numSegmentSize, segmentSize));
}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildUriQueryOrFragmentArbitrary = buildUriQueryOrFragmentArbitrary;
const CharacterRangeArbitraryBuilder_1 = require("./CharacterRangeArbitraryBuilder");
const string_1 = require("../../string");
function buildUriQueryOrFragmentArbitrary(size) {
return (0, string_1.string)({ unit: (0, CharacterRangeArbitraryBuilder_1.getOrCreateAlphaNumericPercentArbitrary)("-._~!$&'()*+,;=:@/?"), size });
}