@fncts/test 0.0.32 → 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 +1 -1
- package/_cjs/control/AbstractRunnableSpec.cjs.map +1 -1
- package/_cjs/control/Assertion/api.cjs +6 -5
- package/_cjs/control/Assertion/api.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 +216 -78
- 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/demo.cjs +1 -1
- package/_mjs/api.mjs +5 -5
- package/_mjs/api.mjs.map +1 -1
- package/_mjs/control/AbstractRunnableSpec.mjs +1 -1
- package/_mjs/control/AbstractRunnableSpec.mjs.map +1 -1
- package/_mjs/control/Assertion/api.mjs +6 -5
- package/_mjs/control/Assertion/api.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 +198 -71
- package/_mjs/control/Gen/api.mjs.map +1 -1
- package/_mjs/control/Live/definition.mjs +8 -7
- 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/demo.mjs +1 -1
- package/_src/api.ts +1 -1
- package/_src/control/Gen/api.ts +166 -1
- package/_src/control/Live/definition.ts +8 -9
- package/_src/control/TestAspect/api.ts +2 -2
- package/_src/demo.ts +1 -1
- package/api.d.ts +1 -1
- package/control/Gen/api.d.ts +46 -1
- package/control/Live/definition.d.ts +6 -2
- package/package.json +3 -3
package/_cjs/control/Gen/api.cjs
CHANGED
@@ -5,10 +5,10 @@ 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;
|
@@ -16,20 +16,20 @@ exports.fullUnicodeChar = exports.fromIOSample = exports.fromIO = exports.floatW
|
|
16
16
|
exports.fullUnicodeString = fullUnicodeString;
|
17
17
|
exports.hexChar = void 0;
|
18
18
|
exports.hexString = hexString;
|
19
|
-
exports.map = exports.intWith = exports.int = void 0;
|
19
|
+
exports.map = exports.intWith = exports.int8Array = exports.int32Array = exports.int16Array = exports.int = void 0;
|
20
20
|
exports.mapIO = mapIO;
|
21
21
|
exports.medium = medium;
|
22
|
-
exports.memo =
|
22
|
+
exports.memo = void 0;
|
23
23
|
exports.nat = nat;
|
24
24
|
exports.oneOf = void 0;
|
25
25
|
exports.partial = partial;
|
26
|
-
exports.size = exports.reshrink = exports.printableChar = void 0;
|
26
|
+
exports.size = exports.reshrink = exports.record = exports.printableChar = void 0;
|
27
27
|
exports.sized = sized;
|
28
28
|
exports.string = exports.small = void 0;
|
29
29
|
exports.string16 = string16;
|
30
30
|
exports.stringN = void 0;
|
31
31
|
exports.struct = struct;
|
32
|
-
exports.tuple =
|
32
|
+
exports.uint8Array = exports.uint32Array = exports.uint16Array = exports.tuple = void 0;
|
33
33
|
exports.unfoldGen = unfoldGen;
|
34
34
|
exports.unicodeChar = exports.unfoldGenN = void 0;
|
35
35
|
exports.unicodeString = unicodeString;
|
@@ -38,25 +38,27 @@ exports.uniqueArray = uniqueArray;
|
|
38
38
|
exports.weighted = exports.unwrap = exports.uniqueConcN = exports.uniqueConc = void 0;
|
39
39
|
exports.zip = zip;
|
40
40
|
exports.zipWith = void 0;
|
41
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
42
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
43
|
-
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
44
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
45
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
46
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
47
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
48
|
-
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
49
|
-
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
50
|
-
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Conc/api/
|
51
|
-
var tsplus_module_11 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
52
|
-
var tsplus_module_12 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
53
|
-
var tsplus_module_13 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
54
|
-
var tsplus_module_14 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
55
|
-
var tsplus_module_15 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
56
|
-
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"));
|
57
57
|
var tsplus_module_17 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/number/instances"));
|
58
58
|
var tsplus_module_18 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/SortedMap/api"));
|
59
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;
|
@@ -103,6 +107,8 @@ const intWith = intWith_1;
|
|
103
107
|
exports.intWith = intWith;
|
104
108
|
const map = map_1;
|
105
109
|
exports.map = map;
|
110
|
+
const memo = memo_1;
|
111
|
+
exports.memo = memo;
|
106
112
|
const oneOf = oneOf_1;
|
107
113
|
exports.oneOf = oneOf;
|
108
114
|
const reshrink = reshrink_1;
|
@@ -125,17 +131,78 @@ const weighted = weighted_1;
|
|
125
131
|
exports.weighted = weighted;
|
126
132
|
const zipWith = zipWith_1;
|
127
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;
|
128
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
|
+
}
|
129
196
|
/**
|
130
197
|
* @tsplus static fncts.test.GenOps size
|
131
198
|
*/
|
132
|
-
const size_1 = /*#__PURE__*/fromIO_1(
|
199
|
+
const size_1 = /*#__PURE__*/fromIO_1(tsplus_module_3.size);
|
133
200
|
const size = size_1;
|
134
201
|
/**
|
135
202
|
* @tsplus static fncts.test.GenOps uniform
|
136
203
|
*/
|
137
204
|
exports.size = size;
|
138
|
-
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));
|
139
206
|
const uniform = uniform_1;
|
140
207
|
/**
|
141
208
|
* @tsplus static fncts.test.GenOps alphaNumericChar
|
@@ -162,13 +229,14 @@ function alphaNumericStringWith(constraints = {}) {
|
|
162
229
|
/**
|
163
230
|
* @tsplus static fncts.test.GenOps alphaNumericString
|
164
231
|
*/
|
165
|
-
const
|
232
|
+
const alphaNumericString_1 = /*#__PURE__*/string_1()(alphaNumericChar_1);
|
233
|
+
const alphaNumericString = alphaNumericString_1;
|
166
234
|
/**
|
167
235
|
* @tsplus static fncts.test.GenOps array
|
168
236
|
* @tsplus getter fncts.test.Gen array
|
169
237
|
*/
|
170
238
|
exports.alphaNumericString = alphaNumericString;
|
171
|
-
function
|
239
|
+
function array_1(self) {
|
172
240
|
return arrayWith_1()(self);
|
173
241
|
}
|
174
242
|
/**
|
@@ -188,22 +256,22 @@ function arrayWith_1(constraints = {}) {
|
|
188
256
|
*/
|
189
257
|
function arrayN_1(n) {
|
190
258
|
return self => {
|
191
|
-
return map_1(conc =>
|
259
|
+
return map_1(conc => tsplus_module_7.toArray(conc))(concN_1(n)(self));
|
192
260
|
};
|
193
261
|
}
|
194
262
|
/**
|
195
263
|
* @tsplus static fncts.test.GenOps arrayInt64
|
196
264
|
*/
|
197
265
|
function arrayInt64_1(min, max) {
|
198
|
-
return new _definition3.Gen(
|
266
|
+
return new _definition3.Gen(tsplus_module_9.map(uncheckedValue => {
|
199
267
|
if (uncheckedValue.data.length === 1) {
|
200
268
|
uncheckedValue.data.unshift(0);
|
201
269
|
}
|
202
|
-
return
|
203
|
-
}, 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(({
|
204
272
|
min,
|
205
273
|
max
|
206
|
-
}) =>
|
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"))));
|
207
275
|
}
|
208
276
|
/**
|
209
277
|
* @tsplus static fncts.test.GenOps asciiChar
|
@@ -242,12 +310,13 @@ function base64StringWith_1(constraints = {}) {
|
|
242
310
|
/**
|
243
311
|
* @tsplus static fncts.test.GenOps bigInt
|
244
312
|
*/
|
245
|
-
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")));
|
246
314
|
/**
|
247
315
|
* @tsplus static fncts.test.GenOps boolean
|
248
316
|
*/
|
249
317
|
exports.bigInt = bigInt;
|
250
|
-
const
|
318
|
+
const boolean_1 = /*#__PURE__*/defer_1(() => oneOf_1(constant_1(true), constant_1(false)));
|
319
|
+
const boolean = boolean_1;
|
251
320
|
/**
|
252
321
|
* @tsplus static fncts.test.GenOps bounded
|
253
322
|
*/
|
@@ -294,25 +363,26 @@ function conc(self) {
|
|
294
363
|
*/
|
295
364
|
function concN_1(n) {
|
296
365
|
return g => {
|
297
|
-
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));
|
298
367
|
};
|
299
368
|
}
|
300
369
|
/**
|
301
370
|
* @tsplus static fncts.test.GenOps constant
|
302
371
|
*/
|
303
372
|
function constant_1(a) {
|
304
|
-
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"));
|
305
374
|
}
|
306
375
|
/**
|
307
376
|
* @tsplus static fncts.test.GenOps defer
|
308
377
|
*/
|
309
378
|
function defer_1(gen) {
|
310
|
-
return flatten_1(fromIO_1(
|
379
|
+
return flatten_1(fromIO_1(tsplus_module_6.succeed(gen, fileName_1 + ":304:31")));
|
311
380
|
}
|
312
381
|
/**
|
313
382
|
* @tsplus static fncts.test.GenOps double
|
314
383
|
*/
|
315
|
-
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;
|
316
386
|
/**
|
317
387
|
* @tsplus static fncts.test.GenOps doubleWith
|
318
388
|
*/
|
@@ -324,11 +394,11 @@ function doubleWith(constraints = {}) {
|
|
324
394
|
min = noDefaultInfinity ? -Number.MAX_VALUE : Number.NEGATIVE_INFINITY,
|
325
395
|
max = noDefaultInfinity ? Number.MAX_VALUE : Number.POSITIVE_INFINITY
|
326
396
|
} = constraints;
|
327
|
-
return unwrap_1(
|
328
|
-
const minIndex = yield* _((0, _math.safeDoubleToIndex)(min, "min"), fileName_1 + ":
|
329
|
-
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");
|
330
400
|
if ((0, _math.isStrictlySmaller64)(maxIndex, minIndex)) {
|
331
|
-
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");
|
332
402
|
}
|
333
403
|
if (noNaN) {
|
334
404
|
return map_1(_math.indexToDouble)(arrayInt64_1(minIndex, maxIndex));
|
@@ -339,12 +409,12 @@ function doubleWith(constraints = {}) {
|
|
339
409
|
return map_1(index => {
|
340
410
|
if ((0, _math.isStrictlySmaller64)(maxIndex, index) || (0, _math.isStrictlySmaller64)(index, minIndex)) return Number.NaN;else return (0, _math.indexToDouble)(index);
|
341
411
|
})(arrayInt64_1(minIndexWithNaN, maxIndexWithNaN));
|
342
|
-
}, fileName_1 + ":
|
412
|
+
}, fileName_1 + ":323:11"));
|
343
413
|
}
|
344
414
|
/**
|
345
415
|
* @tsplus static fncts.test.GenOps empty
|
346
416
|
*/
|
347
|
-
const empty_1 = /*#__PURE__*/new _definition3.Gen(
|
417
|
+
const empty_1 = /*#__PURE__*/new _definition3.Gen(tsplus_module_9.empty);
|
348
418
|
const empty = empty_1;
|
349
419
|
/**
|
350
420
|
* @tsplus static fncts.test.GenOps exponential
|
@@ -371,10 +441,10 @@ function filterNot(p) {
|
|
371
441
|
*/
|
372
442
|
function flatMap_1(f) {
|
373
443
|
return ma => {
|
374
|
-
return new _definition3.Gen(
|
444
|
+
return new _definition3.Gen(tsplus_module_4.flatMapStream(ma.sample, sample => {
|
375
445
|
const values = f(sample.value).sample;
|
376
446
|
const shrinks = flatMap_1(a => f(a))(new _definition3.Gen(sample.shrink)).sample;
|
377
|
-
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);
|
378
448
|
}));
|
379
449
|
};
|
380
450
|
}
|
@@ -388,13 +458,13 @@ function flatten_1(mma) {
|
|
388
458
|
* @tsplus static fncts.test.GenOps fromIO
|
389
459
|
*/
|
390
460
|
function fromIO_1(effect) {
|
391
|
-
return fromIOSample_1(
|
461
|
+
return fromIOSample_1(tsplus_module_6.map(tsplus_module_4.noShrink, fileName_1 + ":399:37")(effect));
|
392
462
|
}
|
393
463
|
/**
|
394
464
|
* @tsplus static fncts.test.GenOps fromIOSample
|
395
465
|
*/
|
396
466
|
function fromIOSample_1(effect) {
|
397
|
-
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"));
|
398
468
|
}
|
399
469
|
/**
|
400
470
|
* @tsplus static fncts.test.GenOps floatWith
|
@@ -406,11 +476,11 @@ function floatWith_1(constraints = {}) {
|
|
406
476
|
max = noDefaultInfinity ? _math.MAX_VALUE_32 : Number.POSITIVE_INFINITY,
|
407
477
|
noNaN = false
|
408
478
|
} = constraints;
|
409
|
-
return unwrap_1(
|
410
|
-
const minIndex = yield* _((0, _math.safeFloatToIndex)(min, "min"), fileName_1 + ":
|
411
|
-
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");
|
412
482
|
if (minIndex > maxIndex) {
|
413
|
-
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");
|
414
484
|
}
|
415
485
|
if (noNaN) {
|
416
486
|
return map_1(_math.indexToFloat)(intWith_1({
|
@@ -426,7 +496,7 @@ function floatWith_1(constraints = {}) {
|
|
426
496
|
min: minIndexWithNaN,
|
427
497
|
max: maxIndexWithNaN
|
428
498
|
}));
|
429
|
-
}, fileName_1 + ":
|
499
|
+
}, fileName_1 + ":420:11"));
|
430
500
|
}
|
431
501
|
/**
|
432
502
|
* @tsplus static fncts.test.GenOps float
|
@@ -460,28 +530,29 @@ function hexString(constraints = {}) {
|
|
460
530
|
/**
|
461
531
|
* @tsplus static fncts.test.GenOps int
|
462
532
|
*/
|
463
|
-
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;
|
464
535
|
/**
|
465
536
|
* @tsplus static fncts.test.GenOps intWith
|
466
537
|
*/
|
467
538
|
exports.int = int;
|
468
539
|
function intWith_1(constraints = {}) {
|
469
|
-
return fromIOSample_1(
|
540
|
+
return fromIOSample_1(tsplus_module_6.defer(() => {
|
470
541
|
const min = constraints.min ?? -0x80000000;
|
471
542
|
const max = constraints.max ?? 0x7fffffff;
|
472
543
|
if (min > max || min < Number.MIN_SAFE_INTEGER || max > Number.MAX_SAFE_INTEGER) {
|
473
|
-
return
|
544
|
+
return tsplus_module_6.haltNow(new _exceptions.IllegalArgumentError("invalid bounds", "Gen.intWith"), fileName_1 + ":484:26");
|
474
545
|
} else {
|
475
|
-
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"));
|
476
547
|
}
|
477
|
-
}, fileName_1 + ":
|
548
|
+
}, fileName_1 + ":480:13"));
|
478
549
|
}
|
479
550
|
/**
|
480
551
|
* @tsplus pipeable fncts.test.Gen map
|
481
552
|
*/
|
482
553
|
function map_1(f) {
|
483
554
|
return self => {
|
484
|
-
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));
|
485
556
|
};
|
486
557
|
}
|
487
558
|
/**
|
@@ -489,19 +560,19 @@ function map_1(f) {
|
|
489
560
|
*/
|
490
561
|
function mapIO(f) {
|
491
562
|
return self => {
|
492
|
-
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));
|
493
564
|
};
|
494
565
|
}
|
495
566
|
/**
|
496
567
|
* @tsplus static fncts.test.GenOps medium
|
497
568
|
*/
|
498
569
|
function medium(f, min = 0) {
|
499
|
-
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)));
|
500
571
|
}
|
501
572
|
/**
|
502
573
|
* @tsplus static fncts.test.GenOps memo
|
503
574
|
*/
|
504
|
-
function
|
575
|
+
function memo_1(builder) {
|
505
576
|
const previous = {};
|
506
577
|
let remainingDepth = 10;
|
507
578
|
return maxDepth => {
|
@@ -528,7 +599,7 @@ function nat(max = 0x7fffffff) {
|
|
528
599
|
* @tsplus static fncts.test.GenOps oneOf
|
529
600
|
*/
|
530
601
|
function oneOf_1(...gens) {
|
531
|
-
if (
|
602
|
+
if (tsplus_module_15.isEmpty(gens)) return empty_1;else return flatMap_1(i => gens[i])(intWith_1({
|
532
603
|
min: 0,
|
533
604
|
max: gens.length - 1
|
534
605
|
}));
|
@@ -538,10 +609,10 @@ function oneOf_1(...gens) {
|
|
538
609
|
*/
|
539
610
|
function partial(properties) {
|
540
611
|
const entries = Object.entries(properties);
|
541
|
-
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) => ({
|
542
613
|
...r,
|
543
614
|
[k]: a
|
544
|
-
}))(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);
|
545
616
|
}
|
546
617
|
/**
|
547
618
|
* @tsplus static fncts.test.GenOps printableChar
|
@@ -556,7 +627,7 @@ const printableChar = /*#__PURE__*/char_1({
|
|
556
627
|
exports.printableChar = printableChar;
|
557
628
|
function reshrink_1(f) {
|
558
629
|
return gen => {
|
559
|
-
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));
|
560
631
|
};
|
561
632
|
}
|
562
633
|
/**
|
@@ -569,7 +640,7 @@ function sized(f) {
|
|
569
640
|
* @tsplus static fncts.test.GenOps small
|
570
641
|
*/
|
571
642
|
function small_1(f, min = 0) {
|
572
|
-
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)));
|
573
644
|
}
|
574
645
|
/**
|
575
646
|
* @tsplus static fncts.test.GenOps string16
|
@@ -599,7 +670,7 @@ function stringN_1(n) {
|
|
599
670
|
*/
|
600
671
|
function struct(properties) {
|
601
672
|
const entries = Object.entries(properties);
|
602
|
-
return
|
673
|
+
return tsplus_module_15.foldLeft(constant_1({}), (b, [k, gen]) => zipWith_1(gen, (out, a) => ({
|
603
674
|
...out,
|
604
675
|
[k]: a
|
605
676
|
}))(b))(entries);
|
@@ -614,7 +685,7 @@ function unfoldGen(s, f) {
|
|
614
685
|
* @tsplus static fncts.test.GenOps unfoldGenN
|
615
686
|
*/
|
616
687
|
function unfoldGenN_1(n, s, f) {
|
617
|
-
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));
|
618
689
|
}
|
619
690
|
/**
|
620
691
|
* @tsplus static fncts.test.GenOps unicodeChar
|
@@ -633,7 +704,7 @@ function unicodeString(constraints = {}) {
|
|
633
704
|
*/
|
634
705
|
function uniqueArray(constraints = {}) {
|
635
706
|
return gen => {
|
636
|
-
return map_1(conc =>
|
707
|
+
return map_1(conc => tsplus_module_7.toArray(conc))(uniqueConc_1(constraints)(gen));
|
637
708
|
};
|
638
709
|
}
|
639
710
|
/**
|
@@ -642,8 +713,8 @@ function uniqueArray(constraints = {}) {
|
|
642
713
|
function uniqueConc_1(constraints = {}) {
|
643
714
|
return self => {
|
644
715
|
const minLength = constraints.minLength ?? 0;
|
645
|
-
const eq = constraints.eq ??
|
646
|
-
equals: y => x =>
|
716
|
+
const eq = constraints.eq ?? tsplus_module_2.makeEq({
|
717
|
+
equals: y => x => tsplus_module_1.strictEquals(x, y)
|
647
718
|
});
|
648
719
|
return constraints.maxLength ? bounded_1(minLength, constraints.maxLength, n => uniqueConcN_1(n, eq)(self)) : small_1(n => uniqueConcN_1(n, eq)(self), minLength);
|
649
720
|
};
|
@@ -653,7 +724,7 @@ function uniqueConc_1(constraints = {}) {
|
|
653
724
|
*/
|
654
725
|
function uniqueConcN_1(n, /** @tsplus auto */E) {
|
655
726
|
return self => {
|
656
|
-
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));
|
657
728
|
};
|
658
729
|
}
|
659
730
|
/**
|
@@ -666,11 +737,11 @@ function unwrap_1(effect) {
|
|
666
737
|
* @tsplus static fncts.test.GenOps weighted
|
667
738
|
*/
|
668
739
|
function weighted_1(...gens) {
|
669
|
-
const sum =
|
670
|
-
const [map] =
|
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]) => {
|
671
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);
|
672
743
|
})(gens);
|
673
|
-
return flatMap_1(n =>
|
744
|
+
return flatMap_1(n => tsplus_module_13.getOrElse(() => {
|
674
745
|
throw new _exceptions.NoSuchElementError("Gen.weighted");
|
675
746
|
})(tsplus_module_18.getGte(n)(map)))(uniform_1);
|
676
747
|
}
|
@@ -693,8 +764,75 @@ function zip(that) {
|
|
693
764
|
/**
|
694
765
|
* @tsplus static fncts.test.GenOps tuple
|
695
766
|
*/
|
696
|
-
function
|
697
|
-
return
|
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);
|
698
836
|
}
|
699
837
|
function _char(min, max, mapToCode) {
|
700
838
|
return map_1(n => String.fromCharCode(mapToCode(n)))(intWith_1({
|