@fncts/test 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cjs/api.cjs +5 -5
- package/_cjs/api.cjs.map +1 -1
- package/_cjs/control/AbstractRunnableSpec.cjs +79 -5
- package/_cjs/control/AbstractRunnableSpec.cjs.map +1 -1
- package/_cjs/control/Annotations/definition.cjs +11 -3
- package/_cjs/control/Annotations/definition.cjs.map +1 -1
- package/_cjs/control/Assertion/api.cjs +6 -5
- package/_cjs/control/Assertion/api.cjs.map +1 -1
- package/_cjs/control/DefaultRunnableSpec.cjs +3 -6
- package/_cjs/control/DefaultRunnableSpec.cjs.map +1 -1
- package/_cjs/control/DefaultTestReporter/render.cjs +1 -1
- package/_cjs/control/DefaultTestReporter/render.cjs.map +1 -1
- package/_cjs/control/Gen/api.cjs +240 -81
- package/_cjs/control/Gen/api.cjs.map +1 -1
- package/_cjs/control/Live/definition.cjs +9 -8
- package/_cjs/control/Live/definition.cjs.map +1 -1
- package/_cjs/control/Sample/api.cjs +16 -16
- package/_cjs/control/Sample/api.cjs.map +1 -1
- package/_cjs/control/Spec/api.cjs +7 -7
- package/_cjs/control/Spec/api.cjs.map +1 -1
- package/_cjs/control/TestAnnotationRenderer/api.cjs +6 -5
- package/_cjs/control/TestAnnotationRenderer/api.cjs.map +1 -1
- package/_cjs/control/TestAspect/api.cjs +2 -3
- package/_cjs/control/TestAspect/api.cjs.map +1 -1
- package/_cjs/control/TestClock/definition.cjs +6 -6
- package/_cjs/control/TestClock/definition.cjs.map +1 -1
- package/_cjs/data/AssertionResult.cjs +3 -2
- package/_cjs/data/AssertionResult.cjs.map +1 -1
- package/_cjs/data/AssertionValue/definition.cjs +2 -1
- package/_cjs/data/AssertionValue/definition.cjs.map +1 -1
- package/_cjs/data/FreeBooleanAlgebra/api.cjs +5 -4
- package/_cjs/data/FreeBooleanAlgebra/api.cjs.map +1 -1
- package/_cjs/data/TestAnnotation/api.cjs +3 -2
- package/_cjs/data/TestAnnotation/api.cjs.map +1 -1
- package/_cjs/data/TestAnnotationMap.cjs.map +1 -1
- package/_cjs/demo.cjs +3 -1
- package/_cjs/demo.cjs.map +1 -1
- package/_mjs/api.mjs +5 -5
- package/_mjs/api.mjs.map +1 -1
- package/_mjs/control/AbstractRunnableSpec.mjs +78 -5
- package/_mjs/control/AbstractRunnableSpec.mjs.map +1 -1
- package/_mjs/control/Annotations/definition.mjs +8 -1
- package/_mjs/control/Annotations/definition.mjs.map +1 -1
- package/_mjs/control/Assertion/api.mjs +6 -5
- package/_mjs/control/Assertion/api.mjs.map +1 -1
- package/_mjs/control/DefaultRunnableSpec.mjs +3 -6
- package/_mjs/control/DefaultRunnableSpec.mjs.map +1 -1
- package/_mjs/control/DefaultTestReporter/render.mjs +1 -1
- package/_mjs/control/DefaultTestReporter/render.mjs.map +1 -1
- package/_mjs/control/Gen/api.mjs +219 -73
- package/_mjs/control/Gen/api.mjs.map +1 -1
- package/_mjs/control/Live/definition.mjs +10 -8
- package/_mjs/control/Live/definition.mjs.map +1 -1
- package/_mjs/control/Sample/api.mjs +16 -16
- package/_mjs/control/Sample/api.mjs.map +1 -1
- package/_mjs/control/Spec/api.mjs +7 -7
- package/_mjs/control/Spec/api.mjs.map +1 -1
- package/_mjs/control/TestAnnotationRenderer/api.mjs +6 -5
- package/_mjs/control/TestAnnotationRenderer/api.mjs.map +1 -1
- package/_mjs/control/TestAspect/api.mjs +2 -3
- package/_mjs/control/TestAspect/api.mjs.map +1 -1
- package/_mjs/control/TestClock/definition.mjs +6 -6
- package/_mjs/control/TestClock/definition.mjs.map +1 -1
- package/_mjs/data/AssertionResult.mjs +3 -2
- package/_mjs/data/AssertionResult.mjs.map +1 -1
- package/_mjs/data/AssertionValue/definition.mjs +2 -1
- package/_mjs/data/AssertionValue/definition.mjs.map +1 -1
- package/_mjs/data/FreeBooleanAlgebra/api.mjs +5 -4
- package/_mjs/data/FreeBooleanAlgebra/api.mjs.map +1 -1
- package/_mjs/data/TestAnnotation/api.mjs +3 -2
- package/_mjs/data/TestAnnotation/api.mjs.map +1 -1
- package/_mjs/data/TestAnnotationMap.mjs +2 -1
- package/_mjs/data/TestAnnotationMap.mjs.map +1 -1
- package/_mjs/demo.mjs +3 -1
- package/_mjs/demo.mjs.map +1 -1
- package/_src/api.ts +2 -2
- package/_src/control/AbstractRunnableSpec.ts +93 -11
- package/_src/control/Annotations/definition.ts +4 -0
- package/_src/control/DefaultRunnableSpec.ts +3 -7
- package/_src/control/Gen/api.ts +201 -7
- package/_src/control/Live/definition.ts +8 -9
- package/_src/control/TestAspect/api.ts +2 -2
- package/_src/demo.ts +4 -2
- package/api.d.ts +1 -1
- package/control/AbstractRunnableSpec.d.ts +22 -9
- package/control/Annotations/definition.d.ts +3 -0
- package/control/DefaultRunnableSpec.d.ts +4 -4
- package/control/Gen/api.d.ts +70 -1
- package/control/Live/definition.d.ts +6 -2
- package/package.json +3 -3
- package/_cjs/control/RunnableSpec.cjs +0 -52
- package/_cjs/control/RunnableSpec.cjs.map +0 -1
- package/_cjs/control/TestExecutor.cjs +0 -44
- package/_cjs/control/TestExecutor.cjs.map +0 -1
- package/_cjs/control/TestRunner.cjs +0 -28
- package/_cjs/control/TestRunner.cjs.map +0 -1
- package/_mjs/control/RunnableSpec.mjs +0 -42
- package/_mjs/control/RunnableSpec.mjs.map +0 -1
- package/_mjs/control/TestExecutor.mjs +0 -36
- package/_mjs/control/TestExecutor.mjs.map +0 -1
- package/_mjs/control/TestRunner.mjs +0 -19
- package/_mjs/control/TestRunner.mjs.map +0 -1
- package/_src/control/RunnableSpec.ts +0 -47
- package/_src/control/TestExecutor.ts +0 -52
- package/_src/control/TestRunner.ts +0 -31
- package/control/RunnableSpec.d.ts +0 -11
- package/control/TestExecutor.d.ts +0 -12
- package/control/TestRunner.d.ts +0 -17
package/_cjs/control/Gen/api.cjs
CHANGED
|
@@ -5,32 +5,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.alphaNumericString = exports.alphaNumericChar = void 0;
|
|
7
7
|
exports.alphaNumericStringWith = alphaNumericStringWith;
|
|
8
|
-
exports.
|
|
9
|
-
exports.char16 = exports.char = exports.bounded = exports.boolean = exports.bigInt = exports.base64StringWith = exports.base64String = exports.base64Char = exports.asciiStringWith = exports.asciiString = exports.asciiChar = exports.arrayWith = exports.arrayN = exports.arrayInt64 = void 0;
|
|
8
|
+
exports.anything = anything;
|
|
9
|
+
exports.char16 = exports.char = exports.bounded = exports.boolean = exports.bigInt = exports.base64StringWith = exports.base64String = exports.base64Char = exports.asciiStringWith = exports.asciiString = exports.asciiChar = exports.arrayWith = exports.arrayN = exports.arrayInt64 = exports.array = void 0;
|
|
10
10
|
exports.conc = conc;
|
|
11
|
-
exports.double = exports.defer = exports.constant = exports.concWith = exports.concN = void 0;
|
|
11
|
+
exports.double = exports.defer = exports.date = exports.constant = exports.concWith = exports.concN = void 0;
|
|
12
12
|
exports.doubleWith = doubleWith;
|
|
13
13
|
exports.filter = exports.exponential = exports.empty = void 0;
|
|
14
14
|
exports.filterNot = filterNot;
|
|
15
|
-
exports.flatten = exports.flatMap = void 0;
|
|
16
|
-
exports.floatWith = floatWith;
|
|
17
|
-
exports.fullUnicodeChar = exports.fromIOSample = exports.fromIO = void 0;
|
|
15
|
+
exports.fullUnicodeChar = exports.fromIOSample = exports.fromIO = exports.floatWith = exports.float = exports.flatten = exports.flatMap = void 0;
|
|
18
16
|
exports.fullUnicodeString = fullUnicodeString;
|
|
19
17
|
exports.hexChar = void 0;
|
|
20
18
|
exports.hexString = hexString;
|
|
21
|
-
exports.map = exports.intWith = exports.int = void 0;
|
|
19
|
+
exports.map = exports.intWith = exports.int8Array = exports.int32Array = exports.int16Array = exports.int = void 0;
|
|
22
20
|
exports.mapIO = mapIO;
|
|
23
21
|
exports.medium = medium;
|
|
24
|
-
exports.memo =
|
|
22
|
+
exports.memo = void 0;
|
|
25
23
|
exports.nat = nat;
|
|
26
24
|
exports.oneOf = void 0;
|
|
27
25
|
exports.partial = partial;
|
|
28
|
-
exports.size = exports.reshrink = exports.printableChar = void 0;
|
|
26
|
+
exports.size = exports.reshrink = exports.record = exports.printableChar = void 0;
|
|
29
27
|
exports.sized = sized;
|
|
30
28
|
exports.string = exports.small = void 0;
|
|
31
29
|
exports.string16 = string16;
|
|
32
30
|
exports.stringN = void 0;
|
|
33
31
|
exports.struct = struct;
|
|
32
|
+
exports.uint8Array = exports.uint32Array = exports.uint16Array = exports.tuple = void 0;
|
|
34
33
|
exports.unfoldGen = unfoldGen;
|
|
35
34
|
exports.unicodeChar = exports.unfoldGenN = void 0;
|
|
36
35
|
exports.unicodeString = unicodeString;
|
|
@@ -39,24 +38,27 @@ exports.uniqueArray = uniqueArray;
|
|
|
39
38
|
exports.weighted = exports.unwrap = exports.uniqueConcN = exports.uniqueConc = void 0;
|
|
40
39
|
exports.zip = zip;
|
|
41
40
|
exports.zipWith = void 0;
|
|
42
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
43
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
44
|
-
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
45
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
46
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
47
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
48
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
49
|
-
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
50
|
-
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
51
|
-
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/
|
|
52
|
-
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
53
|
-
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
54
|
-
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
55
|
-
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
56
|
-
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
57
|
-
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
41
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Equatable/api"));
|
|
42
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Eq/definition"));
|
|
43
|
+
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/Sized/api"));
|
|
44
|
+
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/Sample/api"));
|
|
45
|
+
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Random/api"));
|
|
46
|
+
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
|
|
47
|
+
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/definition"));
|
|
48
|
+
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
|
|
49
|
+
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Stream/api"));
|
|
50
|
+
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/empty"));
|
|
51
|
+
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api"));
|
|
52
|
+
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/replicate"));
|
|
53
|
+
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
|
|
54
|
+
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
|
|
55
|
+
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/compat/Array/api"));
|
|
56
|
+
var tsplus_module_16 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/constructors"));
|
|
58
57
|
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/number/instances"));
|
|
59
58
|
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/SortedMap/api"));
|
|
59
|
+
var tsplus_module_19 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/function/api"));
|
|
60
|
+
var tsplus_module_20 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/string/instances"));
|
|
61
|
+
var tsplus_module_21 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Eq/api"));
|
|
60
62
|
var _exceptions = /*#__PURE__*/require("@fncts/base/data/exceptions");
|
|
61
63
|
var _function = /*#__PURE__*/require("@fncts/base/data/function");
|
|
62
64
|
var _math = /*#__PURE__*/require("../../util/math.cjs");
|
|
@@ -65,6 +67,8 @@ var _definition3 = /*#__PURE__*/require("./definition.cjs");
|
|
|
65
67
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
66
68
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
67
69
|
const fileName_1 = "(@fncts/test) src/control/Gen/api.ts";
|
|
70
|
+
const array = array_1;
|
|
71
|
+
exports.array = array;
|
|
68
72
|
const arrayWith = arrayWith_1;
|
|
69
73
|
exports.arrayWith = arrayWith;
|
|
70
74
|
const arrayN = arrayN_1;
|
|
@@ -97,10 +101,14 @@ const fromIO = fromIO_1;
|
|
|
97
101
|
exports.fromIO = fromIO;
|
|
98
102
|
const fromIOSample = fromIOSample_1;
|
|
99
103
|
exports.fromIOSample = fromIOSample;
|
|
104
|
+
const floatWith = floatWith_1;
|
|
105
|
+
exports.floatWith = floatWith;
|
|
100
106
|
const intWith = intWith_1;
|
|
101
107
|
exports.intWith = intWith;
|
|
102
108
|
const map = map_1;
|
|
103
109
|
exports.map = map;
|
|
110
|
+
const memo = memo_1;
|
|
111
|
+
exports.memo = memo;
|
|
104
112
|
const oneOf = oneOf_1;
|
|
105
113
|
exports.oneOf = oneOf;
|
|
106
114
|
const reshrink = reshrink_1;
|
|
@@ -123,17 +131,78 @@ const weighted = weighted_1;
|
|
|
123
131
|
exports.weighted = weighted;
|
|
124
132
|
const zipWith = zipWith_1;
|
|
125
133
|
exports.zipWith = zipWith;
|
|
134
|
+
const tuple = tuple_1;
|
|
135
|
+
exports.tuple = tuple;
|
|
136
|
+
const record = record_1;
|
|
137
|
+
exports.record = record;
|
|
138
|
+
const date = date_1;
|
|
139
|
+
exports.date = date;
|
|
140
|
+
const int8Array = int8Array_1;
|
|
141
|
+
exports.int8Array = int8Array;
|
|
142
|
+
const int16Array = int16Array_1;
|
|
143
|
+
exports.int16Array = int16Array;
|
|
144
|
+
const int32Array = int32Array_1;
|
|
145
|
+
exports.int32Array = int32Array;
|
|
146
|
+
const uint8Array = uint8Array_1;
|
|
147
|
+
exports.uint8Array = uint8Array;
|
|
148
|
+
const uint16Array = uint16Array_1;
|
|
149
|
+
exports.uint16Array = uint16Array;
|
|
150
|
+
const uint32Array = uint32Array_1;
|
|
151
|
+
exports.uint32Array = uint32Array;
|
|
126
152
|
const gapSize = 0xdfff + 1 - 0xd800;
|
|
153
|
+
/**
|
|
154
|
+
* @tsplus static fncts.test.GenOps anything
|
|
155
|
+
*/
|
|
156
|
+
function anything(constraints = {}) {
|
|
157
|
+
const key = constraints.key ?? alphaNumericString_1;
|
|
158
|
+
const maxDepth = constraints.maxDepth ?? 2;
|
|
159
|
+
const maxKeys = constraints.maxKeys ?? 5;
|
|
160
|
+
const values = constraints.values ?? [boolean_1, alphaNumericString_1, double_1, int_1, oneOf_1(alphaNumericString_1, constant_1(null), constant_1(undefined))];
|
|
161
|
+
function mapOf(key, value) {
|
|
162
|
+
return map_1(pairs => new Map(pairs))(uniqueConc_1({
|
|
163
|
+
eq: tsplus_module_2.makeEq({
|
|
164
|
+
equals: ([k1]) => ([k]) => tsplus_module_1.strictEquals(k, k1)
|
|
165
|
+
}),
|
|
166
|
+
maxLength: maxKeys
|
|
167
|
+
})(tuple_1(key, value)));
|
|
168
|
+
}
|
|
169
|
+
function setOf(value) {
|
|
170
|
+
return map_1(values => new Set(values))(uniqueConc_1({
|
|
171
|
+
eq: tsplus_module_2.makeEq({
|
|
172
|
+
equals: v1 => v => tsplus_module_1.strictEquals(v, v1)
|
|
173
|
+
}),
|
|
174
|
+
maxLength: maxKeys
|
|
175
|
+
})(value));
|
|
176
|
+
}
|
|
177
|
+
const base = oneOf_1(...values);
|
|
178
|
+
const arrayBase = oneOf_1(...values.map(gen => arrayWith_1({
|
|
179
|
+
maxLength: maxKeys
|
|
180
|
+
})(gen)));
|
|
181
|
+
const arrayGen = memo_1(n => oneOf_1(arrayBase, arrayWith_1({
|
|
182
|
+
maxLength: maxKeys
|
|
183
|
+
})(gen(n))));
|
|
184
|
+
const objectBase = oneOf_1(...values.map(gen => record_1(key, gen)));
|
|
185
|
+
const objectGen = memo_1(n => oneOf_1(objectBase, record_1(key, gen(n))));
|
|
186
|
+
const setBase = oneOf_1(...values.map(setOf));
|
|
187
|
+
const setGen = memo_1(n => oneOf_1(setBase, setOf(gen(n))));
|
|
188
|
+
const mapBase = oneOf_1(...values.map(value => mapOf(key, value)));
|
|
189
|
+
const mapGen = memo_1(n => oneOf_1(mapBase, mapOf(oneOf_1(key, gen(n)), gen(n))));
|
|
190
|
+
const gen = memo_1(n => {
|
|
191
|
+
if (n <= 0) return base;
|
|
192
|
+
return oneOf_1(base, arrayGen(), objectGen(), ...(constraints.withDate ? [date_1()] : []), ...(constraints.withSet ? [setGen()] : []), ...(constraints.withMap ? [mapGen()] : []), ...(constraints.withTypedArray ? [oneOf_1(int8Array_1(), uint8Array_1(), int16Array_1(), uint16Array_1(), int32Array_1(), uint32Array_1())] : []));
|
|
193
|
+
});
|
|
194
|
+
return gen(maxDepth);
|
|
195
|
+
}
|
|
127
196
|
/**
|
|
128
197
|
* @tsplus static fncts.test.GenOps size
|
|
129
198
|
*/
|
|
130
|
-
const size_1 = /*#__PURE__*/fromIO_1(
|
|
199
|
+
const size_1 = /*#__PURE__*/fromIO_1(tsplus_module_3.size);
|
|
131
200
|
const size = size_1;
|
|
132
201
|
/**
|
|
133
202
|
* @tsplus static fncts.test.GenOps uniform
|
|
134
203
|
*/
|
|
135
204
|
exports.size = size;
|
|
136
|
-
const uniform_1 = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/
|
|
205
|
+
const uniform_1 = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/tsplus_module_6.map(tsplus_module_4.shrinkFractional(0.0), fileName_1 + ":127:82")(tsplus_module_5.nextDouble));
|
|
137
206
|
const uniform = uniform_1;
|
|
138
207
|
/**
|
|
139
208
|
* @tsplus static fncts.test.GenOps alphaNumericChar
|
|
@@ -160,12 +229,14 @@ function alphaNumericStringWith(constraints = {}) {
|
|
|
160
229
|
/**
|
|
161
230
|
* @tsplus static fncts.test.GenOps alphaNumericString
|
|
162
231
|
*/
|
|
163
|
-
const
|
|
232
|
+
const alphaNumericString_1 = /*#__PURE__*/string_1()(alphaNumericChar_1);
|
|
233
|
+
const alphaNumericString = alphaNumericString_1;
|
|
164
234
|
/**
|
|
235
|
+
* @tsplus static fncts.test.GenOps array
|
|
165
236
|
* @tsplus getter fncts.test.Gen array
|
|
166
237
|
*/
|
|
167
238
|
exports.alphaNumericString = alphaNumericString;
|
|
168
|
-
function
|
|
239
|
+
function array_1(self) {
|
|
169
240
|
return arrayWith_1()(self);
|
|
170
241
|
}
|
|
171
242
|
/**
|
|
@@ -185,22 +256,22 @@ function arrayWith_1(constraints = {}) {
|
|
|
185
256
|
*/
|
|
186
257
|
function arrayN_1(n) {
|
|
187
258
|
return self => {
|
|
188
|
-
return map_1(conc =>
|
|
259
|
+
return map_1(conc => tsplus_module_7.toArray(conc))(concN_1(n)(self));
|
|
189
260
|
};
|
|
190
261
|
}
|
|
191
262
|
/**
|
|
192
263
|
* @tsplus static fncts.test.GenOps arrayInt64
|
|
193
264
|
*/
|
|
194
265
|
function arrayInt64_1(min, max) {
|
|
195
|
-
return new _definition3.Gen(
|
|
266
|
+
return new _definition3.Gen(tsplus_module_9.map(uncheckedValue => {
|
|
196
267
|
if (uncheckedValue.data.length === 1) {
|
|
197
268
|
uncheckedValue.data.unshift(0);
|
|
198
269
|
}
|
|
199
|
-
return
|
|
200
|
-
}, fileName_1 + ":
|
|
270
|
+
return tsplus_module_8.just(tsplus_module_4.shrinkArrayInt64(min)(uncheckedValue), fileName_1 + ":190:20");
|
|
271
|
+
}, fileName_1 + ":186:11")(tsplus_module_9.flatMap(({
|
|
201
272
|
min,
|
|
202
273
|
max
|
|
203
|
-
}) =>
|
|
274
|
+
}) => tsplus_module_9.repeatIO(tsplus_module_5.nextArrayIntBetween(min, max, fileName_1 + ":185:76"), fileName_1 + ":185:49"), fileName_1 + ":185:15")(tsplus_module_9.fromIO((0, _math.computeArrayInt64GenerateRange)(min, max, undefined, undefined), fileName_1 + ":184:18"))));
|
|
204
275
|
}
|
|
205
276
|
/**
|
|
206
277
|
* @tsplus static fncts.test.GenOps asciiChar
|
|
@@ -239,12 +310,13 @@ function base64StringWith_1(constraints = {}) {
|
|
|
239
310
|
/**
|
|
240
311
|
* @tsplus static fncts.test.GenOps bigInt
|
|
241
312
|
*/
|
|
242
|
-
const bigInt = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/
|
|
313
|
+
const bigInt = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/tsplus_module_6.map(tsplus_module_4.shrinkBigInt(BigInt(0)), fileName_1 + ":233:98")( /*#__PURE__*/tsplus_module_5.nextBigIntBetween( /*#__PURE__*/BigInt(-1) << /*#__PURE__*/BigInt(255), ( /*#__PURE__*/BigInt(1) << /*#__PURE__*/BigInt(255)) - /*#__PURE__*/BigInt(1), fileName_1 + ":233:27")));
|
|
243
314
|
/**
|
|
244
315
|
* @tsplus static fncts.test.GenOps boolean
|
|
245
316
|
*/
|
|
246
317
|
exports.bigInt = bigInt;
|
|
247
|
-
const
|
|
318
|
+
const boolean_1 = /*#__PURE__*/defer_1(() => oneOf_1(constant_1(true), constant_1(false)));
|
|
319
|
+
const boolean = boolean_1;
|
|
248
320
|
/**
|
|
249
321
|
* @tsplus static fncts.test.GenOps bounded
|
|
250
322
|
*/
|
|
@@ -281,6 +353,7 @@ function concWith_1(constraints = {}) {
|
|
|
281
353
|
}
|
|
282
354
|
/**
|
|
283
355
|
* @tsplus getter fncts.test.Gen conc
|
|
356
|
+
* @tsplus static fncts.test.GenOps conc
|
|
284
357
|
*/
|
|
285
358
|
function conc(self) {
|
|
286
359
|
return concWith_1()(self);
|
|
@@ -290,25 +363,26 @@ function conc(self) {
|
|
|
290
363
|
*/
|
|
291
364
|
function concN_1(n) {
|
|
292
365
|
return g => {
|
|
293
|
-
return
|
|
366
|
+
return tsplus_module_11.foldLeft(constant_1(tsplus_module_10.empty()), (gen, a) => zipWith_1(a, (as, a) => tsplus_module_11.append(a)(as))(gen))(tsplus_module_12.replicate(n, g));
|
|
294
367
|
};
|
|
295
368
|
}
|
|
296
369
|
/**
|
|
297
370
|
* @tsplus static fncts.test.GenOps constant
|
|
298
371
|
*/
|
|
299
372
|
function constant_1(a) {
|
|
300
|
-
return new _definition3.Gen(
|
|
373
|
+
return new _definition3.Gen(tsplus_module_9.succeedNow(tsplus_module_8.just(tsplus_module_4.noShrink(a), fileName_1 + ":297:40"), fileName_1 + ":297:35"));
|
|
301
374
|
}
|
|
302
375
|
/**
|
|
303
376
|
* @tsplus static fncts.test.GenOps defer
|
|
304
377
|
*/
|
|
305
378
|
function defer_1(gen) {
|
|
306
|
-
return flatten_1(fromIO_1(
|
|
379
|
+
return flatten_1(fromIO_1(tsplus_module_6.succeed(gen, fileName_1 + ":304:31")));
|
|
307
380
|
}
|
|
308
381
|
/**
|
|
309
382
|
* @tsplus static fncts.test.GenOps double
|
|
310
383
|
*/
|
|
311
|
-
const
|
|
384
|
+
const double_1 = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/tsplus_module_6.map(tsplus_module_4.shrinkFractional(0), fileName_1 + ":310:81")(tsplus_module_5.nextDouble));
|
|
385
|
+
const double = double_1;
|
|
312
386
|
/**
|
|
313
387
|
* @tsplus static fncts.test.GenOps doubleWith
|
|
314
388
|
*/
|
|
@@ -320,11 +394,11 @@ function doubleWith(constraints = {}) {
|
|
|
320
394
|
min = noDefaultInfinity ? -Number.MAX_VALUE : Number.NEGATIVE_INFINITY,
|
|
321
395
|
max = noDefaultInfinity ? Number.MAX_VALUE : Number.POSITIVE_INFINITY
|
|
322
396
|
} = constraints;
|
|
323
|
-
return unwrap_1(
|
|
324
|
-
const minIndex = yield* _((0, _math.safeDoubleToIndex)(min, "min"), fileName_1 + ":
|
|
325
|
-
const maxIndex = yield* _((0, _math.safeDoubleToIndex)(max, "max"), fileName_1 + ":
|
|
397
|
+
return unwrap_1(tsplus_module_6.gen(function* (_) {
|
|
398
|
+
const minIndex = yield* _((0, _math.safeDoubleToIndex)(min, "min"), fileName_1 + ":324:32");
|
|
399
|
+
const maxIndex = yield* _((0, _math.safeDoubleToIndex)(max, "max"), fileName_1 + ":325:32");
|
|
326
400
|
if ((0, _math.isStrictlySmaller64)(maxIndex, minIndex)) {
|
|
327
|
-
return yield* _(
|
|
401
|
+
return yield* _(tsplus_module_6.haltNow(new _exceptions.IllegalArgumentError("min must be less than or equal to max", "Gen.double"), fileName_1 + ":327:35"), fileName_1 + ":327:24");
|
|
328
402
|
}
|
|
329
403
|
if (noNaN) {
|
|
330
404
|
return map_1(_math.indexToDouble)(arrayInt64_1(minIndex, maxIndex));
|
|
@@ -335,12 +409,12 @@ function doubleWith(constraints = {}) {
|
|
|
335
409
|
return map_1(index => {
|
|
336
410
|
if ((0, _math.isStrictlySmaller64)(maxIndex, index) || (0, _math.isStrictlySmaller64)(index, minIndex)) return Number.NaN;else return (0, _math.indexToDouble)(index);
|
|
337
411
|
})(arrayInt64_1(minIndexWithNaN, maxIndexWithNaN));
|
|
338
|
-
}, fileName_1 + ":
|
|
412
|
+
}, fileName_1 + ":323:11"));
|
|
339
413
|
}
|
|
340
414
|
/**
|
|
341
415
|
* @tsplus static fncts.test.GenOps empty
|
|
342
416
|
*/
|
|
343
|
-
const empty_1 = /*#__PURE__*/new _definition3.Gen(
|
|
417
|
+
const empty_1 = /*#__PURE__*/new _definition3.Gen(tsplus_module_9.empty);
|
|
344
418
|
const empty = empty_1;
|
|
345
419
|
/**
|
|
346
420
|
* @tsplus static fncts.test.GenOps exponential
|
|
@@ -367,10 +441,10 @@ function filterNot(p) {
|
|
|
367
441
|
*/
|
|
368
442
|
function flatMap_1(f) {
|
|
369
443
|
return ma => {
|
|
370
|
-
return new _definition3.Gen(
|
|
444
|
+
return new _definition3.Gen(tsplus_module_4.flatMapStream(ma.sample, sample => {
|
|
371
445
|
const values = f(sample.value).sample;
|
|
372
446
|
const shrinks = flatMap_1(a => f(a))(new _definition3.Gen(sample.shrink)).sample;
|
|
373
|
-
return
|
|
447
|
+
return tsplus_module_9.map(maybeSample => tsplus_module_13.map(sample => tsplus_module_4.flatMap(b => new _Sample.Sample(b, shrinks))(sample))(maybeSample), fileName_1 + ":382:26")(values);
|
|
374
448
|
}));
|
|
375
449
|
};
|
|
376
450
|
}
|
|
@@ -384,29 +458,29 @@ function flatten_1(mma) {
|
|
|
384
458
|
* @tsplus static fncts.test.GenOps fromIO
|
|
385
459
|
*/
|
|
386
460
|
function fromIO_1(effect) {
|
|
387
|
-
return fromIOSample_1(
|
|
461
|
+
return fromIOSample_1(tsplus_module_6.map(tsplus_module_4.noShrink, fileName_1 + ":399:37")(effect));
|
|
388
462
|
}
|
|
389
463
|
/**
|
|
390
464
|
* @tsplus static fncts.test.GenOps fromIOSample
|
|
391
465
|
*/
|
|
392
466
|
function fromIOSample_1(effect) {
|
|
393
|
-
return new _definition3.Gen(
|
|
467
|
+
return new _definition3.Gen(tsplus_module_9.fromIO(tsplus_module_6.map(tsplus_module_8.just, fileName_1 + ":406:42")(effect), fileName_1 + ":406:31"));
|
|
394
468
|
}
|
|
395
469
|
/**
|
|
396
470
|
* @tsplus static fncts.test.GenOps floatWith
|
|
397
471
|
*/
|
|
398
|
-
function
|
|
472
|
+
function floatWith_1(constraints = {}) {
|
|
399
473
|
const {
|
|
400
474
|
noDefaultInfinity = false,
|
|
401
475
|
min = noDefaultInfinity ? -_math.MAX_VALUE_32 : Number.NEGATIVE_INFINITY,
|
|
402
476
|
max = noDefaultInfinity ? _math.MAX_VALUE_32 : Number.POSITIVE_INFINITY,
|
|
403
477
|
noNaN = false
|
|
404
478
|
} = constraints;
|
|
405
|
-
return unwrap_1(
|
|
406
|
-
const minIndex = yield* _((0, _math.safeFloatToIndex)(min, "min"), fileName_1 + ":
|
|
407
|
-
const maxIndex = yield* _((0, _math.safeFloatToIndex)(max, "max"), fileName_1 + ":
|
|
479
|
+
return unwrap_1(tsplus_module_6.gen(function* (_) {
|
|
480
|
+
const minIndex = yield* _((0, _math.safeFloatToIndex)(min, "min"), fileName_1 + ":421:32");
|
|
481
|
+
const maxIndex = yield* _((0, _math.safeFloatToIndex)(max, "max"), fileName_1 + ":422:32");
|
|
408
482
|
if (minIndex > maxIndex) {
|
|
409
|
-
return yield* _(
|
|
483
|
+
return yield* _(tsplus_module_6.haltNow(new Error("Gen.float constraints.min must be less than or equal to constraints.max"), fileName_1 + ":425:21"), fileName_1 + ":424:24");
|
|
410
484
|
}
|
|
411
485
|
if (noNaN) {
|
|
412
486
|
return map_1(_math.indexToFloat)(intWith_1({
|
|
@@ -422,11 +496,16 @@ function floatWith(constraints = {}) {
|
|
|
422
496
|
min: minIndexWithNaN,
|
|
423
497
|
max: maxIndexWithNaN
|
|
424
498
|
}));
|
|
425
|
-
}, fileName_1 + ":
|
|
499
|
+
}, fileName_1 + ":420:11"));
|
|
426
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* @tsplus static fncts.test.GenOps float
|
|
503
|
+
*/
|
|
504
|
+
const float = /*#__PURE__*/floatWith_1();
|
|
427
505
|
/**
|
|
428
506
|
* @tsplus static fncts.test.GenOps fullUnicodeChar
|
|
429
507
|
*/
|
|
508
|
+
exports.float = float;
|
|
430
509
|
const fullUnicodeChar_1 = /*#__PURE__*/_char(0x0000, 0x10ffff - gapSize, unicodeToCharCode);
|
|
431
510
|
const fullUnicodeChar = fullUnicodeChar_1;
|
|
432
511
|
/**
|
|
@@ -451,28 +530,29 @@ function hexString(constraints = {}) {
|
|
|
451
530
|
/**
|
|
452
531
|
* @tsplus static fncts.test.GenOps int
|
|
453
532
|
*/
|
|
454
|
-
const
|
|
533
|
+
const int_1 = /*#__PURE__*/fromIOSample_1( /*#__PURE__*/tsplus_module_6.map(tsplus_module_4.shrinkIntegral(0), fileName_1 + ":473:75")(tsplus_module_5.nextInt));
|
|
534
|
+
const int = int_1;
|
|
455
535
|
/**
|
|
456
536
|
* @tsplus static fncts.test.GenOps intWith
|
|
457
537
|
*/
|
|
458
538
|
exports.int = int;
|
|
459
539
|
function intWith_1(constraints = {}) {
|
|
460
|
-
return fromIOSample_1(
|
|
540
|
+
return fromIOSample_1(tsplus_module_6.defer(() => {
|
|
461
541
|
const min = constraints.min ?? -0x80000000;
|
|
462
542
|
const max = constraints.max ?? 0x7fffffff;
|
|
463
543
|
if (min > max || min < Number.MIN_SAFE_INTEGER || max > Number.MAX_SAFE_INTEGER) {
|
|
464
|
-
return
|
|
544
|
+
return tsplus_module_6.haltNow(new _exceptions.IllegalArgumentError("invalid bounds", "Gen.intWith"), fileName_1 + ":484:26");
|
|
465
545
|
} else {
|
|
466
|
-
return
|
|
546
|
+
return tsplus_module_6.map(tsplus_module_4.shrinkIntegral(min), fileName_1 + ":486:51")(tsplus_module_5.nextIntBetween(min, max, fileName_1 + ":486:37"));
|
|
467
547
|
}
|
|
468
|
-
}, fileName_1 + ":
|
|
548
|
+
}, fileName_1 + ":480:13"));
|
|
469
549
|
}
|
|
470
550
|
/**
|
|
471
551
|
* @tsplus pipeable fncts.test.Gen map
|
|
472
552
|
*/
|
|
473
553
|
function map_1(f) {
|
|
474
554
|
return self => {
|
|
475
|
-
return new _definition3.Gen(
|
|
555
|
+
return new _definition3.Gen(tsplus_module_9.map(maybeSample => tsplus_module_13.map(sample => tsplus_module_4.map(f)(sample))(maybeSample), fileName_1 + ":497:35")(self.sample));
|
|
476
556
|
};
|
|
477
557
|
}
|
|
478
558
|
/**
|
|
@@ -480,19 +560,19 @@ function map_1(f) {
|
|
|
480
560
|
*/
|
|
481
561
|
function mapIO(f) {
|
|
482
562
|
return self => {
|
|
483
|
-
return new _definition3.Gen(
|
|
563
|
+
return new _definition3.Gen(tsplus_module_9.mapIO(maybeSample => tsplus_module_14.match(() => tsplus_module_6.succeedNow(tsplus_module_8.nothing(fileName_1 + ":509:38"), fileName_1 + ":509:30"), sample => tsplus_module_6.map(tsplus_module_8.just, fileName_1 + ":510:44")(tsplus_module_4.foreach(f)(sample)))(maybeSample), fileName_1 + ":507:24")(self.sample));
|
|
484
564
|
};
|
|
485
565
|
}
|
|
486
566
|
/**
|
|
487
567
|
* @tsplus static fncts.test.GenOps medium
|
|
488
568
|
*/
|
|
489
569
|
function medium(f, min = 0) {
|
|
490
|
-
return flatMap_1(f)(reshrink_1(
|
|
570
|
+
return flatMap_1(f)(reshrink_1(tsplus_module_4.shrinkIntegral(min))(flatMap_1(max => map_1(n => (0, _math.clamp)(Math.round(n * max / 10.0), min, max))(exponential_1))(size_1)));
|
|
491
571
|
}
|
|
492
572
|
/**
|
|
493
573
|
* @tsplus static fncts.test.GenOps memo
|
|
494
574
|
*/
|
|
495
|
-
function
|
|
575
|
+
function memo_1(builder) {
|
|
496
576
|
const previous = {};
|
|
497
577
|
let remainingDepth = 10;
|
|
498
578
|
return maxDepth => {
|
|
@@ -519,17 +599,20 @@ function nat(max = 0x7fffffff) {
|
|
|
519
599
|
* @tsplus static fncts.test.GenOps oneOf
|
|
520
600
|
*/
|
|
521
601
|
function oneOf_1(...gens) {
|
|
522
|
-
if (
|
|
602
|
+
if (tsplus_module_15.isEmpty(gens)) return empty_1;else return flatMap_1(i => gens[i])(intWith_1({
|
|
523
603
|
min: 0,
|
|
524
604
|
max: gens.length - 1
|
|
525
605
|
}));
|
|
526
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* @tsplus static fncts.test.GenOps partial
|
|
609
|
+
*/
|
|
527
610
|
function partial(properties) {
|
|
528
611
|
const entries = Object.entries(properties);
|
|
529
|
-
return
|
|
612
|
+
return tsplus_module_15.foldLeft(constant_1({}), (b, [k, gen]) => unwrap_1(tsplus_module_6.ifIO(() => tsplus_module_6.succeed(() => zipWith_1(gen, (r, a) => ({
|
|
530
613
|
...r,
|
|
531
614
|
[k]: a
|
|
532
|
-
}))(b), fileName_1 + ":
|
|
615
|
+
}))(b), fileName_1 + ":575:50"), () => tsplus_module_6.succeed(() => b, fileName_1 + ":575:108"), fileName_1 + ":575:39")(tsplus_module_5.nextBoolean)))(entries);
|
|
533
616
|
}
|
|
534
617
|
/**
|
|
535
618
|
* @tsplus static fncts.test.GenOps printableChar
|
|
@@ -544,7 +627,7 @@ const printableChar = /*#__PURE__*/char_1({
|
|
|
544
627
|
exports.printableChar = printableChar;
|
|
545
628
|
function reshrink_1(f) {
|
|
546
629
|
return gen => {
|
|
547
|
-
return new _definition3.Gen(
|
|
630
|
+
return new _definition3.Gen(tsplus_module_9.map(maybeSample => tsplus_module_13.map(sample => f(sample.value))(maybeSample), fileName_1 + ":590:69")(gen.sample));
|
|
548
631
|
};
|
|
549
632
|
}
|
|
550
633
|
/**
|
|
@@ -557,7 +640,7 @@ function sized(f) {
|
|
|
557
640
|
* @tsplus static fncts.test.GenOps small
|
|
558
641
|
*/
|
|
559
642
|
function small_1(f, min = 0) {
|
|
560
|
-
return flatMap_1(f)(reshrink_1(
|
|
643
|
+
return flatMap_1(f)(reshrink_1(tsplus_module_4.shrinkIntegral(min))(flatMap_1(max => map_1(n => (0, _math.clamp)(Math.round(n * max / 25), min, max))(exponential_1))(size_1)));
|
|
561
644
|
}
|
|
562
645
|
/**
|
|
563
646
|
* @tsplus static fncts.test.GenOps string16
|
|
@@ -582,9 +665,12 @@ function stringN_1(n) {
|
|
|
582
665
|
return map_1(arr => arr.join(""))(arrayN_1(n)(char));
|
|
583
666
|
};
|
|
584
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* @tsplus static fncts.test.GenOps struct
|
|
670
|
+
*/
|
|
585
671
|
function struct(properties) {
|
|
586
672
|
const entries = Object.entries(properties);
|
|
587
|
-
return
|
|
673
|
+
return tsplus_module_15.foldLeft(constant_1({}), (b, [k, gen]) => zipWith_1(gen, (out, a) => ({
|
|
588
674
|
...out,
|
|
589
675
|
[k]: a
|
|
590
676
|
}))(b))(entries);
|
|
@@ -599,7 +685,7 @@ function unfoldGen(s, f) {
|
|
|
599
685
|
* @tsplus static fncts.test.GenOps unfoldGenN
|
|
600
686
|
*/
|
|
601
687
|
function unfoldGenN_1(n, s, f) {
|
|
602
|
-
if (n <= 0) return constant_1(
|
|
688
|
+
if (n <= 0) return constant_1(tsplus_module_16.make());else return flatMap_1(([s, a]) => map_1(as => tsplus_module_11.append(a)(as))(unfoldGenN_1(n - 1, s, f)))(f(s));
|
|
603
689
|
}
|
|
604
690
|
/**
|
|
605
691
|
* @tsplus static fncts.test.GenOps unicodeChar
|
|
@@ -618,7 +704,7 @@ function unicodeString(constraints = {}) {
|
|
|
618
704
|
*/
|
|
619
705
|
function uniqueArray(constraints = {}) {
|
|
620
706
|
return gen => {
|
|
621
|
-
return map_1(conc =>
|
|
707
|
+
return map_1(conc => tsplus_module_7.toArray(conc))(uniqueConc_1(constraints)(gen));
|
|
622
708
|
};
|
|
623
709
|
}
|
|
624
710
|
/**
|
|
@@ -627,8 +713,8 @@ function uniqueArray(constraints = {}) {
|
|
|
627
713
|
function uniqueConc_1(constraints = {}) {
|
|
628
714
|
return self => {
|
|
629
715
|
const minLength = constraints.minLength ?? 0;
|
|
630
|
-
const eq = constraints.eq ??
|
|
631
|
-
equals: y => x =>
|
|
716
|
+
const eq = constraints.eq ?? tsplus_module_2.makeEq({
|
|
717
|
+
equals: y => x => tsplus_module_1.strictEquals(x, y)
|
|
632
718
|
});
|
|
633
719
|
return constraints.maxLength ? bounded_1(minLength, constraints.maxLength, n => uniqueConcN_1(n, eq)(self)) : small_1(n => uniqueConcN_1(n, eq)(self), minLength);
|
|
634
720
|
};
|
|
@@ -638,7 +724,7 @@ function uniqueConc_1(constraints = {}) {
|
|
|
638
724
|
*/
|
|
639
725
|
function uniqueConcN_1(n, /** @tsplus auto */E) {
|
|
640
726
|
return self => {
|
|
641
|
-
return
|
|
727
|
+
return tsplus_module_11.foldLeft(constant_1(tsplus_module_10.empty()), (gen, a) => zipWith_1(a, (as, a) => tsplus_module_11.elem(a, E)(as) ? as : tsplus_module_11.append(a)(as))(gen))(tsplus_module_12.replicate(n, self));
|
|
642
728
|
};
|
|
643
729
|
}
|
|
644
730
|
/**
|
|
@@ -651,11 +737,11 @@ function unwrap_1(effect) {
|
|
|
651
737
|
* @tsplus static fncts.test.GenOps weighted
|
|
652
738
|
*/
|
|
653
739
|
function weighted_1(...gens) {
|
|
654
|
-
const sum =
|
|
655
|
-
const [map] =
|
|
656
|
-
if ((acc + d) / sum > acc / sum) return
|
|
740
|
+
const sum = tsplus_module_15.foldLeft(0, (b, a) => b + a)(gens.map(([, weight]) => weight));
|
|
741
|
+
const [map] = tsplus_module_15.foldLeft(tsplus_module_19.tuple(tsplus_module_18.make(tsplus_module_17.Ord), 0), ([map, acc], [gen, d]) => {
|
|
742
|
+
if ((acc + d) / sum > acc / sum) return tsplus_module_19.tuple(tsplus_module_18.set((acc + d) / sum, gen)(map), acc + d);else return tsplus_module_19.tuple(map, acc);
|
|
657
743
|
})(gens);
|
|
658
|
-
return flatMap_1(n =>
|
|
744
|
+
return flatMap_1(n => tsplus_module_13.getOrElse(() => {
|
|
659
745
|
throw new _exceptions.NoSuchElementError("Gen.weighted");
|
|
660
746
|
})(tsplus_module_18.getGte(n)(map)))(uniform_1);
|
|
661
747
|
}
|
|
@@ -672,9 +758,82 @@ function zipWith_1(that, f) {
|
|
|
672
758
|
*/
|
|
673
759
|
function zip(that) {
|
|
674
760
|
return self => {
|
|
675
|
-
return zipWith_1(that,
|
|
761
|
+
return zipWith_1(that, tsplus_module_19.tuple)(self);
|
|
676
762
|
};
|
|
677
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* @tsplus static fncts.test.GenOps tuple
|
|
766
|
+
*/
|
|
767
|
+
function tuple_1(...components) {
|
|
768
|
+
return tsplus_module_15.foldLeft(constant_1([]), (b, a) => zipWith_1(a, (vs, v) => [...vs, v])(b))(components);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* @tsplus static fncts.test.GenOps record
|
|
772
|
+
*/
|
|
773
|
+
function record_1(key, value, constraints) {
|
|
774
|
+
return map_1(pairs => tsplus_module_11.foldLeft({}, (b, [k, v]) => ({
|
|
775
|
+
...b,
|
|
776
|
+
[k]: v
|
|
777
|
+
}))(pairs))(uniqueConc_1({
|
|
778
|
+
eq: tsplus_module_21.contramap(([k]) => k)(tsplus_module_20.Eq),
|
|
779
|
+
...constraints
|
|
780
|
+
})(tuple_1(key, value)));
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* @tsplus static fncts.test.GenOps date
|
|
784
|
+
*/
|
|
785
|
+
function date_1(constraints = {}) {
|
|
786
|
+
const min = constraints.min ? constraints.min.getTime() : -8640000000000000;
|
|
787
|
+
const max = constraints.max ? constraints.max.getTime() : 8640000000000000;
|
|
788
|
+
return map_1(n => new Date(n))(intWith_1({
|
|
789
|
+
min,
|
|
790
|
+
max
|
|
791
|
+
}));
|
|
792
|
+
}
|
|
793
|
+
function typedArray(constraints, minBound, maxBound, ctor) {
|
|
794
|
+
const min = constraints.min ? (0, _math.clamp)(constraints.min, minBound, maxBound) : minBound;
|
|
795
|
+
const max = constraints.max ? (0, _math.clamp)(constraints.max, minBound, maxBound) : maxBound;
|
|
796
|
+
return map_1(n => new ctor(n))(array_1(intWith_1({
|
|
797
|
+
min,
|
|
798
|
+
max
|
|
799
|
+
})));
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* @tsplus static fncts.test.GenOps int8Array
|
|
803
|
+
*/
|
|
804
|
+
function int8Array_1(constraints = {}) {
|
|
805
|
+
return typedArray(constraints, -128, 127, Int8Array);
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* @tsplus static fncts.test.GenOps int16Array
|
|
809
|
+
*/
|
|
810
|
+
function int16Array_1(constraints = {}) {
|
|
811
|
+
return typedArray(constraints, -32768, 32767, Int16Array);
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* @tsplus static fncts.test.GenOps int32Array
|
|
815
|
+
*/
|
|
816
|
+
function int32Array_1(constraints = {}) {
|
|
817
|
+
return typedArray(constraints, -0x80000000, 0x7fffffff, Int32Array);
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* @tsplus static fncts.test.GenOps uint8Array
|
|
821
|
+
*/
|
|
822
|
+
function uint8Array_1(constraints = {}) {
|
|
823
|
+
return typedArray(constraints, 0, 255, Uint8Array);
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* @tsplus static fncts.test.GenOps uint16Array
|
|
827
|
+
*/
|
|
828
|
+
function uint16Array_1(constraints = {}) {
|
|
829
|
+
return typedArray(constraints, 0, 65535, Uint16Array);
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* @tsplus static fncts.test.GenOps uint32Array
|
|
833
|
+
*/
|
|
834
|
+
function uint32Array_1(constraints = {}) {
|
|
835
|
+
return typedArray(constraints, 0, 0xffffffff, Uint32Array);
|
|
836
|
+
}
|
|
678
837
|
function _char(min, max, mapToCode) {
|
|
679
838
|
return map_1(n => String.fromCharCode(mapToCode(n)))(intWith_1({
|
|
680
839
|
min,
|