functionalscript 0.0.422 → 0.0.425

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.
Files changed (46) hide show
  1. package/.github/workflows/bun.yml +1 -1
  2. package/.github/workflows/deno.yml +1 -1
  3. package/com/cpp/test/build.cjs +1 -1
  4. package/com/cpp/{test.f.cjs → testlib.f.cjs} +1 -1
  5. package/com/cs/test/build.cjs +1 -1
  6. package/com/cs/{test.f.cjs → testlib.f.cjs} +1 -1
  7. package/com/rust/test.f.cjs +2 -4
  8. package/com/types/{test.f.cjs → testlib.f.cjs} +0 -0
  9. package/commonjs/build/test.f.cjs +2 -4
  10. package/commonjs/package/dependencies/test.f.cjs +1 -3
  11. package/commonjs/package/test.f.cjs +1 -5
  12. package/commonjs/path/test.f.cjs +158 -170
  13. package/commonjs/test.cjs +52 -61
  14. package/html/test.f.cjs +12 -13
  15. package/json/test.f.cjs +41 -37
  16. package/json/tokenizer/test.f.cjs +238 -296
  17. package/nodejs/version/test.f.cjs +1 -3
  18. package/package.json +2 -2
  19. package/sha2/test.f.cjs +37 -40
  20. package/test.f.cjs +49 -86
  21. package/test.mjs +142 -0
  22. package/text/test.f.cjs +1 -3
  23. package/text/utf16/test.f.cjs +96 -109
  24. package/text/utf8/test.f.cjs +116 -135
  25. package/tsconfig.json +1 -1
  26. package/types/array/test.f.cjs +83 -85
  27. package/types/bigint/test.f.cjs +6 -6
  28. package/types/btree/find/test.f.cjs +2 -2
  29. package/types/btree/remove/test.f.cjs +6 -3
  30. package/types/btree/set/test.f.cjs +372 -370
  31. package/types/btree/test.f.cjs +11 -7
  32. package/types/byteSet/module.f.cjs +2 -4
  33. package/types/byteSet/test.f.cjs +37 -40
  34. package/types/function/compare/module.f.cjs +1 -1
  35. package/types/function/compare/test.f.cjs +1 -3
  36. package/types/function/test.f.cjs +1 -3
  37. package/types/list/test.f.cjs +208 -219
  38. package/types/map/test.f.cjs +57 -57
  39. package/types/nibbleSet/test.f.cjs +37 -40
  40. package/types/number/test.f.cjs +24 -26
  41. package/types/object/test.f.cjs +12 -13
  42. package/types/option/test.f.cjs +1 -3
  43. package/types/range/test.f.cjs +1 -3
  44. package/types/string/test.f.cjs +37 -40
  45. package/types/stringset/test.f.cjs +32 -33
  46. package/denotest.mjs +0 -96
@@ -6,230 +6,195 @@ const { addition, strictEqual, reduceToScan } = require('../function/operator/mo
6
6
  /** @type {(sequence: _.List<json.Unknown>) => string} */
7
7
  const stringify = sequence => json.stringify(sort)(_.toArray(sequence))
8
8
 
9
- {
10
- const x = stringify(_.toArray(_.take(10)(_.cycle([1, 2, 3]))))
11
- if (x !== '[1,2,3,1,2,3,1,2,3,1]') { throw x }
12
- }
13
-
14
- {
9
+ const stringifyTest = () => {
15
10
  const s = stringify([1, 2, 3])
16
11
  if (s !== '[1,2,3]') { throw s }
17
12
  }
18
13
 
19
- {
14
+ const cycle = () => {
15
+ const x = stringify(_.toArray(_.take(10)(_.cycle([1, 2, 3]))))
16
+ if (x !== '[1,2,3,1,2,3,1,2,3,1]') { throw x }
17
+ }
18
+
19
+ const countdown = () => {
20
20
  const result = stringify(_.countdown(10))
21
21
  if (result !== '[9,8,7,6,5,4,3,2,1,0]') { throw result }
22
22
  }
23
23
 
24
- {
24
+ const flat = () => {
25
25
  const result = stringify(_.flat([[1, 2, 3], [4, 5], [6], [], [7, 8, 9]]))
26
26
  if (result !== '[1,2,3,4,5,6,7,8,9]') { throw result }
27
27
  }
28
28
 
29
- {
29
+ const concat = () => {
30
30
  const result = _.concat([1])([2])
31
31
  const x = _.next(result)
32
32
  if (x === undefined) { throw x }
33
33
  if (x.first !== 1) { throw x }
34
34
  }
35
35
 
36
- {
36
+ const flatMap = () => {
37
37
  const result = stringify(_.flatMap(x => [x, x * 2, x * 3])([0, 1, 2, 3]))
38
38
  if (result !== '[0,0,0,1,2,3,2,4,6,3,6,9]') { throw result }
39
39
  }
40
40
 
41
- {
42
- const result = stringify(_.takeWhile(x => x < 6)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
43
- if (result !== '[1,2,3,4,5]') { throw result }
44
- }
45
-
46
- {
47
- const result = stringify(_.take(3)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
48
- if (result !== '[1,2,3]') { throw result }
49
- }
50
-
51
- {
52
- const result = stringify(_.take(20)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
53
- if (result !== '[1,2,3,4,5,6,7,8,9]') { throw result }
54
- }
55
-
56
- {
57
- const result = stringify(_.take(0)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
58
- if (result !== '[]') { throw result }
59
- }
60
-
61
- {
62
- const result = _.find(undefined)(x => x % 2 === 0)([1, 3, 5, 7])
63
- if (result !== undefined) { throw result }
64
- }
65
-
66
- {
67
- const result = _.find(undefined)(x => x % 2 === 0)([1, 2, 3, 4])
68
- if (result !== 2) { throw result }
69
- }
70
-
71
- {
72
- const result = stringify(_.takeWhile(x => x < 10)([1, 2, 3, 4, 5, 10, 11]))
73
- if (result !== '[1,2,3,4,5]') { throw result }
74
- }
41
+ const take = [
42
+ () => {
43
+ const result = stringify(_.take(3)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
44
+ if (result !== '[1,2,3]') { throw result }
45
+ },
46
+ () => {
47
+ const result = stringify(_.take(20)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
48
+ if (result !== '[1,2,3,4,5,6,7,8,9]') { throw result }
49
+ },
50
+ () => {
51
+ const result = stringify(_.take(0)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
52
+ if (result !== '[]') { throw result }
53
+ }
54
+ ]
55
+
56
+ const find = [
57
+ () => {
58
+ const result = _.find(undefined)(x => x % 2 === 0)([1, 3, 5, 7])
59
+ if (result !== undefined) { throw result }
60
+ },
61
+ () => {
62
+ const result = _.find(undefined)(x => x % 2 === 0)([1, 2, 3, 4])
63
+ if (result !== 2) { throw result }
64
+ }
65
+ ]
66
+
67
+ const takeWhile = [
68
+ () => {
69
+ const result = stringify(_.takeWhile(x => x < 10)([1, 2, 3, 4, 5, 10, 11]))
70
+ if (result !== '[1,2,3,4,5]') { throw result }
71
+ },
72
+ () => {
73
+ const result = stringify(_.takeWhile(x => x < 6)([1, 2, 3, 4, 5, 6, 7, 8, 9]))
74
+ if (result !== '[1,2,3,4,5]') { throw result }
75
+ }
76
+ ]
75
77
 
76
- {
78
+ const dropWhile = () => {
77
79
  const result = stringify(_.dropWhile(x => x < 10)([1, 2, 3, 4, 5, 10, 11]))
78
80
  if (result !== '[10,11]') { throw result }
79
81
  }
80
82
 
81
- {
82
- const result = stringify(_.drop(3)([1, 2, 3, 4, 5, 10, 11]))
83
- if (result !== '[4,5,10,11]') { throw result }
84
- }
85
-
86
- {
87
- const result = stringify(_.drop(0)([1, 2, 3, 4, 5, 10, 11]))
88
- if (result !== '[1,2,3,4,5,10,11]') { throw result }
89
- }
90
-
91
- {
92
- const result = stringify(_.drop(10)([1, 2, 3, 4, 5, 10, 11]))
93
- if (result !== '[]') { throw result }
94
- }
95
-
96
- {
97
- const op = reduceToScan(addition)
98
- const result = stringify(_.scan(op)([2, 3, 4, 5]))
99
- if (result !== '[2,5,9,14]') { throw result }
100
- }
101
-
102
- {
103
- const result = _.reduce(addition)(undefined)([2, 3, 4, 5])
104
- if (result !== 14) { throw result }
105
- }
106
-
107
- {
108
- const result = _.reduce(addition)(undefined)([])
109
- if (result !== undefined) { throw result }
110
- }
111
-
112
- {
113
- const result = stringify(_.entries([]))
114
- if (result !== '[]') { throw result }
115
- }
116
-
117
- {
118
- const result = stringify(_.entries(['hello', 'world']))
119
- if (result !== '[[0,"hello"],[1,"world"]]') { throw result }
120
- }
121
-
122
- {
123
- const result = stringify(_.reverse([]))
124
- if (result !== '[]') { throw result }
125
- }
126
-
127
- {
128
- const result = stringify(_.reverse([1, 2, 3, 4, 5]))
129
- if (result !== '[5,4,3,2,1]') { throw result }
130
- }
131
-
132
- {
133
- const result = stringify(_.zip([0, 1, 2])(['a', 'b', 'c', 'd']))
134
- if (result !== '[[0,"a"],[1,"b"],[2,"c"]]') { throw result }
135
- }
136
-
137
- {
138
- const result = stringify(_.zip([0, 1, 2])(['a', 'b']))
139
- if (result !== '[[0,"a"],[1,"b"]]') { throw result }
140
- }
141
-
142
- const map5 = _.map(x => x > 5)
143
-
144
- {
145
- const result = _.some(map5([0, 1, 7]))
146
- if (!result) { throw result }
147
- }
148
-
149
- {
150
- const result = _.some(map5([0, 1, 4]))
151
- if (result) { throw result }
152
- }
153
-
154
- {
155
- const result = _.some(map5([]))
156
- if (result) { throw result }
157
- }
158
-
159
- {
160
- const result = _.every(map5([0, 1, 7]))
161
- if (result) { throw result }
162
- }
163
-
164
- {
165
- const result = _.every(map5([6, 11, 7]))
166
- if (!result) { throw result }
167
- }
168
-
169
- {
170
- const result = _.every(map5([]))
171
- if (!result) { throw result }
172
- }
173
-
174
- {
175
- const result = _.equal(strictEqual)([1])([2, 3])
176
- if (result) { throw result }
177
- }
178
-
179
- {
180
- const result = _.equal(strictEqual)([1, 3])([1])
181
- if (result) { throw result }
182
- }
183
-
184
- {
185
- const result = _.equal(strictEqual)([15, 78])([15, 78])
186
- if (!result) { throw result }
187
- }
188
-
189
- {
190
- const result = _.equal(strictEqual)([])([])
191
- if (!result) { throw result }
192
- }
193
-
194
- {
195
- const result = _.isEmpty(() => [])
196
- if (result !== true) { throw result }
197
- }
198
-
199
- {
200
- const result = _.isEmpty(() => [2])
201
- if (result !== false) { throw result }
83
+ const drop = [
84
+ () => {
85
+ const result = stringify(_.drop(3)([1, 2, 3, 4, 5, 10, 11]))
86
+ if (result !== '[4,5,10,11]') { throw result }
87
+ },
88
+ () => {
89
+ const result = stringify(_.drop(0)([1, 2, 3, 4, 5, 10, 11]))
90
+ if (result !== '[1,2,3,4,5,10,11]') { throw result }
91
+ },
92
+ () => {
93
+ const result = stringify(_.drop(10)([1, 2, 3, 4, 5, 10, 11]))
94
+ if (result !== '[]') { throw result }
95
+ }
96
+ ]
97
+
98
+ const additionTests = [
99
+ () => {
100
+ const op = reduceToScan(addition)
101
+ const result = stringify(_.scan(op)([2, 3, 4, 5]))
102
+ if (result !== '[2,5,9,14]') { throw result }
103
+ },
104
+ () => {
105
+ const result = _.reduce(addition)(undefined)([2, 3, 4, 5])
106
+ if (result !== 14) { throw result }
107
+ },
108
+ () => {
109
+ const result = _.reduce(addition)(undefined)([])
110
+ if (result !== undefined) { throw result }
111
+ }
112
+ ]
113
+
114
+ const entries = [
115
+ () => {
116
+ const result = stringify(_.entries([]))
117
+ if (result !== '[]') { throw result }
118
+ },
119
+ () => {
120
+ const result = stringify(_.entries(['hello', 'world']))
121
+ if (result !== '[[0,"hello"],[1,"world"]]') { throw result }
122
+ }
123
+ ]
124
+
125
+ const reverse = [
126
+ () => {
127
+ const result = stringify(_.reverse([]))
128
+ if (result !== '[]') { throw result }
129
+ },
130
+ () => {
131
+ const result = stringify(_.reverse([1, 2, 3, 4, 5]))
132
+ if (result !== '[5,4,3,2,1]') { throw result }
133
+ }
134
+ ]
135
+
136
+ const zip = [
137
+ () => {
138
+ const result = stringify(_.zip([0, 1, 2])(['a', 'b', 'c', 'd']))
139
+ if (result !== '[[0,"a"],[1,"b"],[2,"c"]]') { throw result }
140
+ },
141
+ () => {
142
+ const result = stringify(_.zip([0, 1, 2])(['a', 'b']))
143
+ if (result !== '[[0,"a"],[1,"b"]]') { throw result }
144
+ }
145
+ ]
146
+
147
+ const logic = () => {
148
+ const map5 = _.map(x => x > 5)
149
+
150
+ return [
151
+ () => {
152
+ const result = _.some(map5([0, 1, 7]))
153
+ if (!result) { throw result }
154
+ },
155
+ () => {
156
+ const result = _.some(map5([0, 1, 4]))
157
+ if (result) { throw result }
158
+ },
159
+ () => {
160
+ const result = _.some(map5([]))
161
+ if (result) { throw result }
162
+ },
163
+ () => {
164
+ const result = _.every(map5([0, 1, 7]))
165
+ if (result) { throw result }
166
+ },
167
+ () => {
168
+ const result = _.every(map5([6, 11, 7]))
169
+ if (!result) { throw result }
170
+ },
171
+ () => {
172
+ const result = _.every(map5([]))
173
+ if (!result) { throw result }
174
+ }
175
+ ]
202
176
  }
203
177
 
204
-
205
-
206
178
  // stress tests
207
179
 
208
- const stress = () => {
209
-
210
- {
180
+ const stress = () => ({
181
+ toArray: () => {
211
182
  // 200_000_000 is too much
212
183
  const n = 100_000_000
213
184
  const result = _.toArray(_.countdown(n))
214
185
  if (result.length !== n) { throw result.length }
215
186
  const len = _.length(_.filter(x => x > n)(result))
216
187
  if (len !== 0) { throw len }
217
- }
218
-
219
- console.log('first')
220
-
221
- {
188
+ },
189
+ first: () => {
222
190
  // 100_000_000 is too much
223
191
  const n = 50_000_000
224
192
  const result = _.toArray(_.countdown(n))
225
193
  if (result.length !== n) { throw result.length }
226
194
  const first = _.first(undefined)(result)
227
195
  if (first !== n - 1) { throw first }
228
- }
229
-
230
- console.log('concat back')
231
-
232
- {
196
+ },
197
+ concatBack: () => {
233
198
  /** @type {_.List<number>} */
234
199
  let sequence = []
235
200
  // 20_000_000 is too much
@@ -237,11 +202,8 @@ const stress = () => {
237
202
  sequence = _.concat(sequence)([i])
238
203
  }
239
204
  const r = _.toArray(sequence)
240
- }
241
-
242
- console.log('flat to Array')
243
-
244
- {
205
+ },
206
+ flatToArray: () => {
245
207
  /** @type {_.List<number>} */
246
208
  let sequence = []
247
209
  // 4_000_000 is too much
@@ -249,23 +211,17 @@ const stress = () => {
249
211
  sequence = _.flat([sequence, [i]])
250
212
  }
251
213
  const r = _.toArray(sequence)
252
- }
253
-
254
- console.log('flat next')
255
-
256
- {
214
+ },
215
+ flatNext: () => {
257
216
  /** @type {_.List<number>} */
258
217
  let sequence = []
259
- // 5_000_000 is too much
260
- for (let i = 0; i < 4_000_000; ++i) {
218
+ // 4_000_000 is too much
219
+ for (let i = 0; i < 2_000_000; ++i) {
261
220
  sequence = _.flat([sequence, [i]])
262
221
  }
263
222
  const a = _.next(sequence)
264
- }
265
-
266
- console.log('concat front')
267
-
268
- {
223
+ },
224
+ concatFront: () => {
269
225
  /** @type {_.List<number>} */
270
226
  let sequence = []
271
227
  // 20_000_000 is too much
@@ -273,9 +229,8 @@ const stress = () => {
273
229
  sequence = _.concat([i])(sequence)
274
230
  }
275
231
  const a = _.next(sequence)
276
- }
277
-
278
- {
232
+ },
233
+ flatFront: () => {
279
234
  /** @type {_.List<number>} */
280
235
  let sequence = []
281
236
  // 10_000_000 is too much
@@ -283,42 +238,76 @@ const stress = () => {
283
238
  sequence = _.flat([[i], sequence])
284
239
  }
285
240
  const a = _.next(sequence)
286
- }
287
-
288
- console.log('filterMap')
289
-
290
- {
241
+ },
242
+ filterMap: () => {
291
243
  // 100_000_000 is too much
292
244
  const n = 50_000_000
293
245
  const result = _.toArray(_.countdown(n))
294
246
  if (result.length !== n) { throw result.length }
295
247
  const len = _.length(_.filterMap(() => undefined)(result))
296
248
  if (len !== 0) { throw len }
297
- }
298
-
299
- console.log('dropWhile')
300
-
301
- {
249
+ },
250
+ dropWhile: () => {
302
251
  // 50_000_000 is too much
303
252
  const n = 20_000_000
304
253
  const result = _.toArray(_.countdown(n))
305
254
  if (result.length !== n) { throw result.length }
306
255
  const len = _.length(_.dropWhile(() => true)(result))
307
256
  if (len !== 0) { throw len }
308
- }
309
-
310
- console.log('reverse')
311
-
312
- {
257
+ },
258
+ reverse: () => {
313
259
  // 10_000_000 is too much
314
260
  const n = 5_000_000
315
261
  const result = _.toArray(_.reverse(_.countdown(n)))
316
262
  if (result.length !== n) { throw result.length }
317
263
  }
318
- }
319
264
 
320
- // stress()
265
+ })
321
266
 
322
267
  module.exports = {
323
-
268
+ stringifyTest,
269
+ cycle,
270
+ countdown,
271
+ flat,
272
+ concat,
273
+ flatMap,
274
+ take,
275
+ find,
276
+ takeWhile,
277
+ dropWhile,
278
+ drop,
279
+ additionTests,
280
+ entries,
281
+ reverse,
282
+ zip,
283
+ logic,
284
+ strictEqual: [
285
+ () => {
286
+ const result = _.equal(strictEqual)([1])([2, 3])
287
+ if (result) { throw result }
288
+ },
289
+ () => {
290
+ const result = _.equal(strictEqual)([1, 3])([1])
291
+ if (result) { throw result }
292
+ },
293
+ () => {
294
+ const result = _.equal(strictEqual)([15, 78])([15, 78])
295
+ if (!result) { throw result }
296
+ },
297
+ () => {
298
+ const result = _.equal(strictEqual)([])([])
299
+ if (!result) { throw result }
300
+ }
301
+ ],
302
+ isEmpty: [
303
+ () => {
304
+ const result = _.isEmpty(() => [])
305
+ if (result !== true) { throw result }
306
+ },
307
+ () => {
308
+ const result = _.isEmpty(() => [2])
309
+ if (result !== false) { throw result }
310
+ }
311
+ ],
312
+ //stress
324
313
  }
@@ -1,74 +1,74 @@
1
1
  const { at, setReplace, setReduce, empty, entries, remove } = require('./module.f.cjs')
2
2
  const seq = require('../list/module.f.cjs')
3
3
 
4
- {
5
- let m = setReplace('a')(1)(undefined)
4
+ module.exports = {
5
+ main: [
6
+ () => {
7
+ let m = setReplace('a')(1)(undefined)
6
8
 
7
- if (at('a')(m) !== 1) { throw 'error' }
8
- if (at('b')(m) !== undefined) { throw 'error' }
9
+ if (at('a')(m) !== 1) { throw 'error' }
10
+ if (at('b')(m) !== undefined) { throw 'error' }
9
11
 
10
- m = setReplace('b')(2)(m)
12
+ m = setReplace('b')(2)(m)
11
13
 
12
- if (at('a')(m) !== 1) { throw 'error' }
13
- if (at('b')(m) !== 2) { throw 'error' }
14
- if (at('c')(m) !== undefined) { throw 'error' }
14
+ if (at('a')(m) !== 1) { throw 'error' }
15
+ if (at('b')(m) !== 2) { throw 'error' }
16
+ if (at('c')(m) !== undefined) { throw 'error' }
15
17
 
16
- m = setReplace('z')(3)(m)
18
+ m = setReplace('z')(3)(m)
17
19
 
18
- if (at('a')(m) !== 1) { throw 'error' }
19
- if (at('b')(m) !== 2) { throw 'error' }
20
- if (at('z')(m) !== 3) { throw 'error' }
21
- if (at('')(m) !== undefined) { throw 'error' }
20
+ if (at('a')(m) !== 1) { throw 'error' }
21
+ if (at('b')(m) !== 2) { throw 'error' }
22
+ if (at('z')(m) !== 3) { throw 'error' }
23
+ if (at('')(m) !== undefined) { throw 'error' }
22
24
 
23
- m = setReplace('')(4)(m)
25
+ m = setReplace('')(4)(m)
24
26
 
25
- if (at('a')(m) !== 1) { throw 'error' }
26
- if (at('b')(m) !== 2) { throw 'error' }
27
- if (at('z')(m) !== 3) { throw 'error' }
28
- if (at('')(m) !== 4) { throw 'error' }
29
- if (at('Hello world!')(m) !== undefined) { throw 'error' }
27
+ if (at('a')(m) !== 1) { throw 'error' }
28
+ if (at('b')(m) !== 2) { throw 'error' }
29
+ if (at('z')(m) !== 3) { throw 'error' }
30
+ if (at('')(m) !== 4) { throw 'error' }
31
+ if (at('Hello world!')(m) !== undefined) { throw 'error' }
30
32
 
31
- m = setReplace('Hello world!')(42)(m)
33
+ m = setReplace('Hello world!')(42)(m)
32
34
 
33
- if (at('a')(m) !== 1) { throw 'error' }
34
- if (at('b')(m) !== 2) { throw 'error' }
35
- if (at('z')(m) !== 3) { throw 'error' }
36
- if (at('')(m) !== 4) { throw 'error' }
37
- if (at('Hello world!')(m) !== 42) { throw 'error' }
38
- if (at('x')(m) !== undefined) { throw 'error' }
35
+ if (at('a')(m) !== 1) { throw 'error' }
36
+ if (at('b')(m) !== 2) { throw 'error' }
37
+ if (at('z')(m) !== 3) { throw 'error' }
38
+ if (at('')(m) !== 4) { throw 'error' }
39
+ if (at('Hello world!')(m) !== 42) { throw 'error' }
40
+ if (at('x')(m) !== undefined) { throw 'error' }
39
41
 
40
- // console.log(Array.from(m.entries()))
41
- m = remove('Hello world!')(m)
42
- if (at('Hello world!')(m) !== undefined) { throw m }
42
+ // console.log(Array.from(m.entries()))
43
+ m = remove('Hello world!')(m)
44
+ if (at('Hello world!')(m) !== undefined) { throw m }
43
45
 
44
- m = setReduce(a => b => a + b)('a')(43)(m)
45
- if (at('a')(m) !== 44) { throw 'error' }
46
- }
47
-
48
- {
49
- let m = setReplace('x')(12)(undefined)
50
- m = setReplace('y')(44)(m)
51
- if (at('x')(m) !== 12) { throw 'error' }
52
- if (at('y')(m) !== 44) { throw 'error' }
53
- if (at('a')(m) !== undefined) { throw 'error' }
54
- const e = seq.toArray(entries(m))
55
- if (e.length !== 2) { throw 'error' }
56
- }
57
-
58
- {
59
- /** @type {import('./module.f.cjs').Map<number>} */
60
- let m = empty
61
- for (let i = 0; i < 100_000; ++i) {
62
- m = setReplace((i * i).toString())(i)(m)
63
- /*
64
- console.log()
65
- console.log(`# ${i}`)
66
- console.log()
67
- for (const e of m.struct()) {
68
- console.log(e)
46
+ m = setReduce(a => b => a + b)('a')(43)(m)
47
+ if (at('a')(m) !== 44) { throw 'error' }
48
+ },
49
+ () => {
50
+ let m = setReplace('x')(12)(undefined)
51
+ m = setReplace('y')(44)(m)
52
+ if (at('x')(m) !== 12) { throw 'error' }
53
+ if (at('y')(m) !== 44) { throw 'error' }
54
+ if (at('a')(m) !== undefined) { throw 'error' }
55
+ const e = seq.toArray(entries(m))
56
+ if (e.length !== 2) { throw 'error' }
57
+ },
58
+ ],
59
+ stress: () => {
60
+ /** @type {import('./module.f.cjs').Map<number>} */
61
+ let m = empty
62
+ for (let i = 0; i < 100_000; ++i) {
63
+ m = setReplace((i * i).toString())(i)(m)
64
+ /*
65
+ console.log()
66
+ console.log(`# ${i}`)
67
+ console.log()
68
+ for (const e of m.struct()) {
69
+ console.log(e)
70
+ }
71
+ */
69
72
  }
70
- */
71
73
  }
72
74
  }
73
-
74
- module.exports = {}