functionalscript 0.0.424 → 0.0.427

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 (39) hide show
  1. package/Cargo.lock +7 -0
  2. package/Cargo.toml +2 -1
  3. package/com/cpp/test.f.cjs +1 -1
  4. package/com/cs/test.f.cjs +1 -1
  5. package/com/rust/module.f.cjs +42 -16
  6. package/com/rust/test.f.cjs +99 -74
  7. package/com/types/{test.f.cjs → testlib.f.cjs} +0 -0
  8. package/commonjs/build/test.f.cjs +2 -4
  9. package/commonjs/package/dependencies/test.f.cjs +1 -3
  10. package/commonjs/package/test.f.cjs +1 -5
  11. package/commonjs/path/test.f.cjs +158 -170
  12. package/commonjs/test.cjs +52 -61
  13. package/html/test.f.cjs +12 -13
  14. package/json/test.f.cjs +41 -37
  15. package/json/tokenizer/test.f.cjs +238 -296
  16. package/nodejs/version/test.f.cjs +1 -3
  17. package/package.json +1 -1
  18. package/sha2/test.f.cjs +37 -40
  19. package/test.mjs +51 -19
  20. package/text/test.f.cjs +1 -3
  21. package/text/utf16/test.f.cjs +96 -109
  22. package/text/utf8/test.f.cjs +116 -135
  23. package/types/array/test.f.cjs +84 -84
  24. package/types/btree/find/test.f.cjs +2 -2
  25. package/types/btree/remove/test.f.cjs +6 -3
  26. package/types/btree/set/test.f.cjs +372 -370
  27. package/types/btree/test.f.cjs +11 -7
  28. package/types/byteSet/module.f.cjs +2 -4
  29. package/types/byteSet/test.f.cjs +37 -40
  30. package/types/function/compare/module.f.cjs +1 -1
  31. package/types/function/compare/test.f.cjs +1 -3
  32. package/types/function/test.f.cjs +1 -3
  33. package/types/list/test.f.cjs +208 -219
  34. package/types/map/test.f.cjs +57 -57
  35. package/types/nibbleSet/test.f.cjs +37 -40
  36. package/types/number/test.f.cjs +24 -26
  37. package/types/object/test.f.cjs +12 -13
  38. package/types/option/test.f.cjs +1 -3
  39. package/types/range/test.f.cjs +1 -3
package/sha2/test.f.cjs CHANGED
@@ -32,45 +32,42 @@ const stringify = a => json.stringify(sort)(a)
32
32
  // console.log(result.map(toHexString))
33
33
  // }
34
34
 
35
- {
36
- const hash = _.computeSha256([])(0)
37
- const result = stringify(hash.map(toHexString))
38
- if (result !== '["e3b0c442","98fc1c14","9afbf4c8","996fb924","27ae41e4","649b934c","a495991b","7852b855"]') { throw result }
39
- }
40
-
41
- {
42
- const hash = _.computeSha224([])(0)
43
- const result = stringify(hash.map(toHexString))
44
- if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') { throw result }
45
- }
46
-
47
- {
48
- //[0x68656C6C, 0x6F20776F, 0x726C6400] represents phrase 'hello world'
49
- const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C6400])(88)
50
- const result = stringify(hash.map(toHexString))
51
- if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') { throw result }
52
- }
53
-
54
- {
55
- //[0x68656C6C, 0x6F20776F, 0x726C6488] represents phrase 'hello world' with 1's at the end
56
- const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C64FF])(88)
57
- const result = stringify(hash.map(toHexString))
58
- if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') { throw result }
59
- }
60
-
61
- {
62
- const input = Array(8).fill(0x31313131)
63
- const result = _.computeSha256(input)(256)
64
- if (toU32(result[0]) !== 0x8a83665f) { throw result[0] }
65
- }
66
-
67
- {
68
- const input = Array(16).fill(0x31313131)
69
- const hash = _.computeSha256(input)(512)
70
- const result = stringify(hash.map(toHexString))
71
- if (result !== '["3138bb9b","c78df27c","473ecfd1","410f7bd4","5ebac1f5","9cf3ff9c","fe4db77a","ab7aedd3"]') { throw result }
72
- }
73
-
74
35
  module.exports = {
75
-
36
+ empty: {
37
+ sha256: () => {
38
+ const hash = _.computeSha256([])(0)
39
+ const result = stringify(hash.map(toHexString))
40
+ if (result !== '["e3b0c442","98fc1c14","9afbf4c8","996fb924","27ae41e4","649b934c","a495991b","7852b855"]') { throw result }
41
+ },
42
+ sha224: () => {
43
+ const hash = _.computeSha224([])(0)
44
+ const result = stringify(hash.map(toHexString))
45
+ if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') { throw result }
46
+ }
47
+ },
48
+ sha256: [
49
+ () => {
50
+ //[0x68656C6C, 0x6F20776F, 0x726C6400] represents phrase 'hello world'
51
+ const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C6400])(88)
52
+ const result = stringify(hash.map(toHexString))
53
+ if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') { throw result }
54
+ },
55
+ () => {
56
+ //[0x68656C6C, 0x6F20776F, 0x726C6488] represents phrase 'hello world' with 1's at the end
57
+ const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C64FF])(88)
58
+ const result = stringify(hash.map(toHexString))
59
+ if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') { throw result }
60
+ },
61
+ () => {
62
+ const input = Array(8).fill(0x31313131)
63
+ const result = _.computeSha256(input)(256)
64
+ if (toU32(result[0]) !== 0x8a83665f) { throw result[0] }
65
+ },
66
+ () => {
67
+ const input = Array(16).fill(0x31313131)
68
+ const hash = _.computeSha256(input)(512)
69
+ const result = stringify(hash.map(toHexString))
70
+ if (result !== '["3138bb9b","c78df27c","473ecfd1","410f7bd4","5ebac1f5","9cf3ff9c","fe4db77a","ab7aedd3"]') { throw result }
71
+ }
72
+ ]
76
73
  }
package/test.mjs CHANGED
@@ -21,7 +21,18 @@
21
21
  /** @type {FsPromises} */
22
22
  const { readdir, readFile } = await import(globalThis.Deno ? 'https://deno.land/std/node/fs/promises.ts' : 'node:fs/promises')
23
23
 
24
- /** @typedef {{ exports?: unknown }} Module */
24
+ /**
25
+ * @typedef {{
26
+ * [k: in string]?: Module
27
+ * }} Dependencies
28
+ */
29
+
30
+ /**
31
+ * @typedef {{
32
+ * dependencies: Dependencies
33
+ * exports?: unknown
34
+ * }} Module
35
+ */
25
36
 
26
37
  /** @typedef {(name: string) => unknown} Require */
27
38
 
@@ -54,7 +65,7 @@ const load = async () => {
54
65
  await f(file)
55
66
  }
56
67
  } else if (name.endsWith('.f.cjs')) {
57
- console.log(`loading ${file}`)
68
+ // console.log(`loading ${file}`)
58
69
  const source = await readFile(file, 'utf8')
59
70
  map.push([file, Function('module', 'require', `"use strict";${source}`)])
60
71
  }
@@ -70,32 +81,42 @@ const map = await load()
70
81
 
71
82
  /**
72
83
  * @typedef {{
73
- * [k in string]: unknown
84
+ * [k in string]: Module
74
85
  * }} ModuleMap
75
86
  */
76
87
 
77
88
  const build = async () => {
78
89
  /** @type {ModuleMap} */
79
90
  const d = {}
80
- /** @type {(base: readonly string[]) => (i: string) => (k: string) => unknown} */
81
- const req = p => i => k => {
91
+ /** @type {(base: readonly string[]) => (i: string) => (k: string) => readonly[string, Module]} */
92
+ const req = base => i => k => {
82
93
  const relativePath = k.split('/')
83
94
  const dif = relativePath.filter(v => v === '..').length
84
- const path = [p.slice(0, p.length - dif), relativePath.filter(v => !['..', '.'].includes(v))]
95
+ const path = [base.slice(0, base.length - dif), relativePath.filter(v => !['..', '.'].includes(v))]
85
96
  .flat()
86
97
  const pathStr = path.join('/')
87
98
  const newBase = path.slice(0, path.length - 1)
88
- const result = d[pathStr]
89
- if (result === undefined) {
99
+ {
100
+ const module = d[pathStr]
101
+ if (module !== undefined) {
102
+ return [pathStr, module]
103
+ }
104
+ }
105
+ {
90
106
  /** @type {Module} */
91
- const me = {}
92
- console.log(`${i}building ${pathStr}`)
93
- map[pathStr](me, req(newBase)(`${i}| `))
94
- const newResult = me.exports
95
- d[pathStr] = newResult
96
- return newResult
97
- } else {
98
- return result
107
+ const module = {
108
+ dependencies: {}
109
+ }
110
+ // console.log(`${i}building ${pathStr}`)
111
+ const getModule = req(newBase)(`${i}| `)
112
+ const newReq = s => {
113
+ const [p, result] = getModule(s)
114
+ module.dependencies[p] = result
115
+ return result.exports
116
+ }
117
+ map[pathStr](module, newReq)
118
+ d[pathStr] = module
119
+ return [pathStr, module]
99
120
  }
100
121
  }
101
122
  const r = req(['.'])('')
@@ -107,6 +128,18 @@ const build = async () => {
107
128
 
108
129
  const modules = await build()
109
130
 
131
+ // graph
132
+
133
+ /*
134
+ for (const [k, v] of Object.entries(modules)) {
135
+ console.log(`: ${k}`)
136
+ console.log(Object.keys(v.dependencies))
137
+ }
138
+ */
139
+
140
+ // test runner.
141
+
142
+ /** @type {(i: string) => (v: unknown) => void} */
110
143
  const test = i => v => {
111
144
  switch (typeof v) {
112
145
  case 'function': {
@@ -124,9 +157,8 @@ const test = i => v => {
124
157
  }
125
158
  } else {
126
159
  for (const [k, v2] of Object.entries(v)) {
127
- const i2 = `${i}| `
128
160
  console.log(`${i}${k}:`)
129
- test(i2)(v2)
161
+ test(`${i}| `)(v2)
130
162
  }
131
163
  }
132
164
  return;
@@ -137,6 +169,6 @@ const test = i => v => {
137
169
  for (const [k, v] of Object.entries(modules)) {
138
170
  if (k.endsWith('test.f.cjs')) {
139
171
  console.log(`testing ${k}`)
140
- test('| ')(v)
172
+ test('| ')(v.exports)
141
173
  }
142
174
  }
package/text/test.f.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const _ = require('./module.f.cjs')
2
2
  const { string: { join } } = require('../types/module.f.cjs')
3
3
 
4
- {
4
+ module.exports = () => {
5
5
  /** @type {_.Block} */
6
6
  const text = [
7
7
  'a',
@@ -15,5 +15,3 @@ const { string: { join } } = require('../types/module.f.cjs')
15
15
  const result = join('\n')(_.flat(':')(text))
16
16
  if (result !== 'a\nb\n:c\n::d\ne') { throw result }
17
17
  }
18
-
19
- module.exports = {}
@@ -6,113 +6,100 @@ const { list } = require('../../types/module.f.cjs')
6
6
  /** @type {(a: readonly json.Unknown[]) => string} */
7
7
  const stringify = a => json.stringify(sort)(a)
8
8
 
9
- {
10
- const result = stringify(list.toArray(encoding.toCodePointList([-1, 65536])))
11
- if (result !== '[4294967295,4294967295]') { throw result }
9
+ module.exports = {
10
+ toCodePointList: [
11
+ () => {
12
+ const result = stringify(list.toArray(encoding.toCodePointList([-1, 65536])))
13
+ if (result !== '[4294967295,4294967295]') { throw result }
14
+ },
15
+ () => {
16
+ const result = stringify(list.toArray(encoding.toCodePointList([0, 36, 8364, 55295, 57344, 65535])))
17
+ if (result !== '[0,36,8364,55295,57344,65535]') { throw result }
18
+ },
19
+ () => {
20
+ const result = stringify(list.toArray(encoding.toCodePointList([56320, 57343])))
21
+ if (result !== '[-2147427328,-2147426305]') { throw result }
22
+ },
23
+ () => {
24
+ const result = stringify(list.toArray(encoding.toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])))
25
+ if (result !== '[65536,66615,150370,1114111]') { throw result }
26
+ },
27
+ () => {
28
+ const result = stringify(list.toArray(encoding.toCodePointList([55296, 55296])))
29
+ if (result !== '[-2147428352,-2147428352]') { throw result }
30
+ },
31
+ () => {
32
+ const result = stringify(list.toArray(encoding.toCodePointList([55296, 0])))
33
+ if (result !== '[-2147428352,0]') { throw result }
34
+ },
35
+ () => {
36
+ const result = stringify(list.toArray(encoding.toCodePointList([56320])))
37
+ if (result !== '[-2147427328]') { throw result }
38
+ },
39
+ () => {
40
+ const result = stringify(list.toArray(encoding.toCodePointList([56320, 0])))
41
+ if (result !== '[-2147427328,0]') { throw result }
42
+ }
43
+ ],
44
+ fromCodePointList: [
45
+ () => {
46
+ const result = stringify(list.toArray(encoding.fromCodePointList([0])))
47
+ if (result !== '[0]') { throw result }
48
+ },
49
+ () => {
50
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x24])))
51
+ if (result !== '[36]') { throw result }
52
+ },
53
+ () => {
54
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x20AC])))
55
+ if (result !== '[8364]') { throw result }
56
+ },
57
+ () => {
58
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xd7ff])))
59
+ if (result !== '[55295]') { throw result }
60
+ },
61
+ () => {
62
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xe000])))
63
+ if (result !== '[57344]') { throw result }
64
+ },
65
+ () => {
66
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
67
+ if (result !== '[65535]') { throw result }
68
+ },
69
+ () => {
70
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
71
+ if (result !== '[55296,56320]') { throw result }
72
+ },
73
+ () => {
74
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10437])))
75
+ if (result !== '[55297,56375]') { throw result }
76
+ },
77
+ () => {
78
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x24B62])))
79
+ if (result !== '[55378,57186]') { throw result }
80
+ },
81
+ () => {
82
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10ffff])))
83
+ if (result !== '[56319,57343]') { throw result }
84
+ },
85
+ () => {
86
+ const result = stringify(list.toArray(encoding.fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])))
87
+ if (result !== '[65535,55296,57343,0]') { throw result }
88
+ }
89
+ ],
90
+ string: [
91
+ () => {
92
+ const utf16List = encoding.stringToList("Hello world!😂🚜🚲")
93
+ const result = encoding.listToString(utf16List)
94
+ if (result !== "Hello world!😂🚜🚲") { throw result }
95
+ },
96
+ () => {
97
+ const a = encoding.stringToList("Hello world!😂🚜🚲")
98
+ const b = encoding.toCodePointList(a)
99
+ const c = encoding.fromCodePointList(b)
100
+ const result = encoding.listToString(c)
101
+ if (result !== "Hello world!😂🚜🚲") { throw result }
102
+
103
+ }
104
+ ]
12
105
  }
13
-
14
- {
15
- const result = stringify(list.toArray(encoding.toCodePointList([0, 36, 8364, 55295, 57344, 65535])))
16
- if (result !== '[0,36,8364,55295,57344,65535]') { throw result }
17
- }
18
-
19
- {
20
- const result = stringify(list.toArray(encoding.toCodePointList([56320, 57343])))
21
- if (result !== '[-2147427328,-2147426305]') { throw result }
22
- }
23
-
24
- {
25
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])))
26
- if (result !== '[65536,66615,150370,1114111]') { throw result }
27
- }
28
-
29
- {
30
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 55296])))
31
- if (result !== '[-2147428352,-2147428352]') { throw result }
32
- }
33
-
34
- {
35
- const result = stringify(list.toArray(encoding.toCodePointList([55296, 0])))
36
- if (result !== '[-2147428352,0]') { throw result }
37
- }
38
-
39
- {
40
- const result = stringify(list.toArray(encoding.toCodePointList([56320])))
41
- if (result !== '[-2147427328]') { throw result }
42
- }
43
-
44
- {
45
- const result = stringify(list.toArray(encoding.toCodePointList([56320, 0])))
46
- if (result !== '[-2147427328,0]') { throw result }
47
- }
48
-
49
- {
50
- const result = stringify(list.toArray(encoding.fromCodePointList([0])))
51
- if (result !== '[0]') { throw result }
52
- }
53
-
54
- {
55
- const result = stringify(list.toArray(encoding.fromCodePointList([0x24])))
56
- if (result !== '[36]') { throw result }
57
- }
58
-
59
- {
60
- const result = stringify(list.toArray(encoding.fromCodePointList([0x20AC])))
61
- if (result !== '[8364]') { throw result }
62
- }
63
-
64
- {
65
- const result = stringify(list.toArray(encoding.fromCodePointList([0xd7ff])))
66
- if (result !== '[55295]') { throw result }
67
- }
68
-
69
- {
70
- const result = stringify(list.toArray(encoding.fromCodePointList([0xe000])))
71
- if (result !== '[57344]') { throw result }
72
- }
73
-
74
- {
75
- const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
76
- if (result !== '[65535]') { throw result }
77
- }
78
-
79
- {
80
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
81
- if (result !== '[55296,56320]') { throw result }
82
- }
83
-
84
- {
85
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10437])))
86
- if (result !== '[55297,56375]') { throw result }
87
- }
88
-
89
- {
90
- const result = stringify(list.toArray(encoding.fromCodePointList([0x24B62])))
91
- if (result !== '[55378,57186]') { throw result }
92
- }
93
-
94
- {
95
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10ffff])))
96
- if (result !== '[56319,57343]') { throw result }
97
- }
98
-
99
- {
100
- const result = stringify(list.toArray(encoding.fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])))
101
- if (result !== '[65535,55296,57343,0]') { throw result }
102
- }
103
-
104
- {
105
- const utf16List = encoding.stringToList("Hello world!😂🚜🚲")
106
- const result = encoding.listToString(utf16List)
107
- if (result !== "Hello world!😂🚜🚲") { throw result }
108
- }
109
-
110
- {
111
- const a = encoding.stringToList("Hello world!😂🚜🚲")
112
- const b = encoding.toCodePointList(a)
113
- const c = encoding.fromCodePointList(b)
114
- const result = encoding.listToString(c)
115
- if (result !== "Hello world!😂🚜🚲") { throw result }
116
- }
117
-
118
- module.exports = {}
@@ -6,139 +6,120 @@ const { list } = require('../../types/module.f.cjs')
6
6
  /** @type {(a: readonly json.Unknown[]) => string} */
7
7
  const stringify = a => json.stringify(sort)(a)
8
8
 
9
- {
10
- const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])))
11
- if (result !== '[2147483648,2147483648]') { throw result }
9
+ module.exports = {
10
+ toCodePoint: [
11
+ () => {
12
+ const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])))
13
+ if (result !== '[2147483648,2147483648]') { throw result }
14
+ },
15
+ () => {
16
+ const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])))
17
+ if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') { throw result }
18
+ },
19
+ () => {
20
+ const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])))
21
+ if (result !== '[0,1,127]') { throw result }
22
+ },
23
+ () => {
24
+ const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])))
25
+ if (result !== '[128,169,2047]') { throw result }
26
+ },
27
+ () => {
28
+ const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])))
29
+ if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') { throw result }
30
+ },
31
+ () => {
32
+ const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])))
33
+ if (result !== '[2048,2049,65535]') { throw result }
34
+ },
35
+ () => {
36
+ const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])))
37
+ if (result !== '[-2147483424,-2147482592,127,-2147481601]') { throw result }
38
+ },
39
+ () => {
40
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])))
41
+ if (result !== '[65536,65537,1114111]') { throw result }
42
+ },
43
+ () => {
44
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])))
45
+ if (result !== '[-2147483408,-2147483104,127,-2147482817]') { throw result }
46
+ },
47
+ () => {
48
+ const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])))
49
+ if (result !== '[-2147448800,-2147432416]') { throw result }
50
+ }
51
+ ],
52
+ fromCodePointList: [
53
+ () => {
54
+ const result = stringify(list.toArray(encoding.fromCodePointList([0, 1, 0x7F])))
55
+ if (result !== '[0,1,127]') { throw result }
56
+ },
57
+ () => {
58
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x80])))
59
+ if (result !== '[194,128]') { throw result }
60
+ },
61
+ () => {
62
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])))
63
+ if (result !== '[194,169]') { throw result }
64
+ },
65
+ () => {
66
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])))
67
+ if (result !== '[223,191]') { throw result }
68
+ },
69
+ () => {
70
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x800])))
71
+ if (result !== '[224,160,128]') { throw result }
72
+ },
73
+ () => {
74
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x801])))
75
+ if (result !== '[224,160,129]') { throw result }
76
+ },
77
+ () => {
78
+ const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
79
+ if (result !== '[239,191,191]') { throw result }
80
+ },
81
+ () => {
82
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
83
+ if (result !== '[240,144,128,128]') { throw result }
84
+ },
85
+ () => {
86
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])))
87
+ if (result !== '[240,144,128,129]') { throw result }
88
+ },
89
+ () => {
90
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])))
91
+ if (result !== '[244,143,191,191]') { throw result }
92
+ },
93
+ () => {
94
+ const result = stringify(list.toArray(encoding.fromCodePointList([0x110000, 2147483648])))
95
+ if (result !== '[2147483648,2147483648]') { throw result }
96
+ }
97
+ ],
98
+ toFrom: [
99
+ () => {
100
+ const codePointList = encoding.toCodePointList([128, 193, 245, 255])
101
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
102
+ if (result !== '[128,193,245,255]') { throw result }
103
+ },
104
+ () => {
105
+ const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194])
106
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
107
+ if (result !== '[194,194,127,194,192,194]') { throw result }
108
+ },
109
+ () => {
110
+ const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191])
111
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
112
+ if (result !== '[224,224,160,127,239,191]') { throw result }
113
+ },
114
+ () => {
115
+ const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191])
116
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
117
+ if (result !== '[240,240,160,127,244,191]') { throw result }
118
+ },
119
+ () => {
120
+ const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160])
121
+ const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
122
+ if (result !== '[240,160,160,244,160,160]') { throw result }
123
+ }
124
+ ]
12
125
  }
13
-
14
- {
15
- const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])))
16
- if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') { throw result }
17
- }
18
-
19
- {
20
- const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])))
21
- if (result !== '[0,1,127]') { throw result }
22
- }
23
-
24
- {
25
- const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])))
26
- if (result !== '[128,169,2047]') { throw result }
27
- }
28
-
29
- {
30
- const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])))
31
- if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') { throw result }
32
- }
33
-
34
- {
35
- const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])))
36
- if (result !== '[2048,2049,65535]') { throw result }
37
- }
38
-
39
- {
40
- const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])))
41
- if (result !== '[-2147483424,-2147482592,127,-2147481601]') { throw result }
42
- }
43
-
44
- {
45
- const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])))
46
- if (result !== '[65536,65537,1114111]') { throw result }
47
- }
48
-
49
- {
50
- const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])))
51
- if (result !== '[-2147483408,-2147483104,127,-2147482817]') { throw result }
52
- }
53
-
54
- {
55
- const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])))
56
- if (result !== '[-2147448800,-2147432416]') { throw result }
57
- }
58
-
59
- {
60
- const result = stringify(list.toArray(encoding.fromCodePointList([0,1,0x7F])))
61
- if (result !== '[0,1,127]') { throw result }
62
- }
63
-
64
- {
65
- const result = stringify(list.toArray(encoding.fromCodePointList([0x80])))
66
- if (result !== '[194,128]') { throw result }
67
- }
68
-
69
- {
70
- const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])))
71
- if (result !== '[194,169]') { throw result }
72
- }
73
-
74
- {
75
- const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])))
76
- if (result !== '[223,191]') { throw result }
77
- }
78
-
79
- {
80
- const result = stringify(list.toArray(encoding.fromCodePointList([0x800])))
81
- if (result !== '[224,160,128]') { throw result }
82
- }
83
-
84
- {
85
- const result = stringify(list.toArray(encoding.fromCodePointList([0x801])))
86
- if (result !== '[224,160,129]') { throw result }
87
- }
88
-
89
- {
90
- const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])))
91
- if (result !== '[239,191,191]') { throw result }
92
- }
93
-
94
- {
95
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])))
96
- if (result !== '[240,144,128,128]') { throw result }
97
- }
98
-
99
- {
100
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])))
101
- if (result !== '[240,144,128,129]') { throw result }
102
- }
103
-
104
- {
105
- const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])))
106
- if (result !== '[244,143,191,191]') { throw result }
107
- }
108
-
109
- {
110
- const result = stringify(list.toArray(encoding.fromCodePointList([0x110000,2147483648])))
111
- if (result !== '[2147483648,2147483648]') { throw result }
112
- }
113
-
114
- {
115
- const codePointList = encoding.toCodePointList([128, 193, 245, 255])
116
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
117
- if (result !== '[128,193,245,255]') { throw result }
118
- }
119
-
120
- {
121
- const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194])
122
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
123
- if (result !== '[194,194,127,194,192,194]') { throw result }
124
- }
125
-
126
- {
127
- const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191])
128
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
129
- if (result !== '[224,224,160,127,239,191]') { throw result }
130
- }
131
-
132
- {
133
- const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191])
134
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
135
- if (result !== '[240,240,160,127,244,191]') { throw result }
136
- }
137
-
138
- {
139
- const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160])
140
- const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)))
141
- if (result !== '[240,160,160,244,160,160]') { throw result }
142
- }
143
-
144
- module.exports = {}