functionalscript 0.0.354 → 0.0.357

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.
@@ -0,0 +1,112 @@
1
+ const types = require('../types/main.f.js')
2
+ const text = require('../../text/main.f.js')
3
+ const list = require('../../types/list/main.f.js')
4
+ const obj = require('../../types/object/main.f.js')
5
+
6
+ /** @type {(v: string) => string} */
7
+ const csUsing = v => `using ${v};`
8
+
9
+ /** @type {(type: string) => (name: string) => (body: text.Block) => text.Block} */
10
+ const csBlock = type => name => body => [`${type} ${name}`, '{', body, '}']
11
+
12
+ /**
13
+ * @type {(attributes: list.List<string>) =>
14
+ * (type: string) =>
15
+ * (name: string) =>
16
+ * (body: text.Block) =>
17
+ * list.List<text.Item>}
18
+ */
19
+ const csTypeDef = attributes => type => name => body =>
20
+ list.flat([
21
+ list.map(v => `[${v}]`)(attributes),
22
+ csBlock(`public ${type}`)(name)(body)
23
+ ])
24
+
25
+ /** @type {(t: types.BaseType) => string} */
26
+ const csBaseType = t => {
27
+ switch (t) {
28
+ case 'bool': return 'bool'
29
+ case 'f32': return 'float'
30
+ case 'f64': return 'double'
31
+ case 'i16': return 'short'
32
+ case 'i32': return 'int'
33
+ case 'i64': return 'long'
34
+ case 'i8': return 'sbyte'
35
+ case 'isize': return 'IntPtr'
36
+ case 'u16': return 'ushort'
37
+ case 'u32': return 'uint'
38
+ case 'u64': return 'ulong'
39
+ case 'u8': return 'byte'
40
+ case 'usize': return 'UIntPtr'
41
+ }
42
+ }
43
+
44
+ /** @type {(isUnsafe: boolean) => string} */
45
+ const unsafe = isUnsafe => isUnsafe ? 'unsafe ' : ''
46
+
47
+ /** @type {(t: types.Type) => readonly[boolean, string]} */
48
+ const csType = t =>
49
+ typeof (t) === 'string' ? [false, csBaseType(t)] :
50
+ t instanceof Array ? [false, t[0]] :
51
+ [true, `${csType(t['*'])[1]}*`]
52
+
53
+ /** @type {(f: types.Field) => string} */
54
+ const csParam = ([name, type]) => `${csType(type)[1]} ${name}`
55
+
56
+ /** @type {(f: types.Field) => string} */
57
+ const csField = ([name, type]) => {
58
+ const [isUnsafe, t] = csType(type)
59
+ return `public ${unsafe(isUnsafe)}${t} ${name};`
60
+ }
61
+
62
+ /** @type {(m: types.Method) => readonly[boolean, string]} */
63
+ const csResult = m => m.length === 2 ? [false, 'void'] : csType(m[2])
64
+
65
+ /** @type {(field: types.Field) => boolean} */
66
+ const isUnsafeField = field => csType(field[1])[0]
67
+
68
+ /** @type {(m: types.Method) => readonly string[]} */
69
+ const csMethod = m => {
70
+ const result = csResult(m)
71
+ const isUnsafe = result[0] || list.some(list.map(isUnsafeField)(m[1]))
72
+ return [
73
+ '[PreserveSig]',
74
+ `${unsafe(isUnsafe)}${result[1]} ${m[0]}(${list.join(', ')(list.map(csParam)(m[1]))});`
75
+ ]
76
+ }
77
+
78
+ /** @type {(e: obj.Entry<types.Definition>) => list.List<text.Item>} */
79
+ const csDef = ([n, d]) => {
80
+ const i = d.interface
81
+ return i === undefined ?
82
+ csTypeDef
83
+ (['StructLayout(LayoutKind.Sequential)'])
84
+ ('struct')
85
+ (n)
86
+ (() => list.map(csField)(d.struct)) :
87
+ csTypeDef
88
+ ([`Guid("${d.guid}")`, 'InterfaceType(ComInterfaceType.InterfaceIsIUnknown)'])
89
+ ('interface')
90
+ (n)
91
+ (() => list.flatMap(csMethod)(d.interface))
92
+ }
93
+
94
+ /** @type {(name: string) => (library: types.Library) => text.Block} */
95
+ const cs = name => library => {
96
+ const v = list.flatMap(csDef)(Object.entries(library))
97
+
98
+ /** @type {text.Block} */
99
+ const h = [
100
+ csUsing('System'),
101
+ csUsing('System.Runtime.InteropServices'),
102
+ ''
103
+ ]
104
+
105
+ const ns = csBlock('namespace')(name)(() => v)
106
+ return () => list.flat([h, ns])
107
+ }
108
+
109
+ module.exports = {
110
+ /** @readonly */
111
+ cs,
112
+ }
@@ -0,0 +1,2 @@
1
+ // See https://aka.ms/new-console-template for more information
2
+ Console.WriteLine("Hello, World!");
@@ -0,0 +1,11 @@
1
+ const fs = require('node:fs')
2
+ const cp = require('node:child_process')
3
+ const cs = require('../test.f.js').result
4
+
5
+ fs.writeFileSync('_result.cs', cs)
6
+ try {
7
+ console.log(cp.execSync('dotnet build').toString())
8
+ } catch (e) {
9
+ // @ts-ignore
10
+ console.log(e.output.toString())
11
+ }
@@ -0,0 +1,11 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <OutputType>Exe</OutputType>
5
+ <TargetFramework>net6.0</TargetFramework>
6
+ <ImplicitUsings>enable</ImplicitUsings>
7
+ <Nullable>enable</Nullable>
8
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
9
+ </PropertyGroup>
10
+
11
+ </Project>
@@ -1,8 +1,9 @@
1
+ const types = require('../types/main.f.js')
1
2
  const _ = require('./main.f.js')
2
- const list = require('../types/list/main.f.js')
3
- const text = require('../text/main.f.js')
3
+ const list = require('../../types/list/main.f.js')
4
+ const text = require('../../text/main.f.js')
4
5
 
5
- /** @type {_.Library} */
6
+ /** @type {types.Library} */
6
7
  const library = {
7
8
  Slice: {
8
9
  struct: [
@@ -15,10 +16,13 @@ const library = {
15
16
  interface: [
16
17
  ['GetSlice', [], ['Slice']],
17
18
  ['SetSlice', [['slice', ['Slice']]]],
19
+ ['GetUnsafe', [], {'*': 'bool'}],
20
+ ['SetUnsafe', [['p', {'*': ['Slice']}], ['size', 'u32']]],
18
21
  ],
19
22
  }
20
23
  }
21
24
 
25
+ const f = () =>
22
26
  {
23
27
  const cs = list.join('\n')(text.flat(' ')(_.cs('My')(library)))
24
28
  const e =
@@ -30,20 +34,30 @@ const library = {
30
34
  ' [StructLayout(LayoutKind.Sequential)]\n' +
31
35
  ' public struct Slice\n' +
32
36
  ' {\n' +
33
- ' public byte* Start;\n' +
37
+ ' public unsafe byte* Start;\n' +
34
38
  ' public UIntPtr Size;\n' +
35
39
  ' }\n' +
36
40
  ' [Guid("C66FB270-2D80-49AD-BB6E-88C1F90B805D")]\n' +
37
- ' [InterfaceType(ComInterfaceType.InterfaceIsUnknown)]\n' +
41
+ ' [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n' +
38
42
  ' public interface IMy\n' +
39
43
  ' {\n' +
40
44
  ' [PreserveSig]\n' +
41
45
  ' Slice GetSlice();\n' +
42
46
  ' [PreserveSig]\n' +
43
47
  ' void SetSlice(Slice slice);\n' +
48
+ ' [PreserveSig]\n' +
49
+ ' unsafe bool* GetUnsafe();\n' +
50
+ ' [PreserveSig]\n' +
51
+ ' unsafe void SetUnsafe(Slice* p, uint size);\n' +
44
52
  ' }\n' +
45
53
  '}'
46
54
  if (cs !== e) { throw [cs,e] }
55
+ return cs
47
56
  }
48
57
 
49
- module.exports = {}
58
+ const result = f()
59
+
60
+ module.exports = {
61
+ /** @readonly */
62
+ result,
63
+ }
package/com/main.f.js CHANGED
@@ -1,136 +1,6 @@
1
- const text = require('../text/main.f.js')
2
- const list = require('../types/list/main.f')
3
- const obj = require('../types/object/main.f.js')
4
-
5
- /** @typedef {{readonly[k in string]: Definition}} Library */
6
-
7
- /** @typedef {Struct|Interface} Definition */
8
-
9
- /**
10
- * @typedef {{
11
- * readonly interface?: undefined
12
- * readonly struct: FieldArray
13
- * }} Struct
14
- */
15
-
16
- /** @typedef {readonly Field[]} FieldArray */
17
-
18
- /** @typedef {[string, Type]} Field */
19
-
20
- /**
21
- * @typedef {{
22
- * readonly interface: MethodArray
23
- * readonly guid: string
24
- * }} Interface
25
- */
26
-
27
- /** @typedef {readonly Method[]} MethodArray */
28
-
29
- /** @typedef {readonly[string, FieldArray, Type]} GetMethod */
30
-
31
- /** @typedef {readonly[string, FieldArray]} SetMethod */
32
-
33
- /** @typedef {GetMethod|SetMethod} Method */
34
-
35
- /** @typedef {BaseType|Id|Pointer} Type */
36
-
37
- /** @typedef {readonly[string]} Id */
38
-
39
- /** @typedef {'u8'|'i8'|'u16'|'i16'|'u32'|'i32'|'u64'|'i64'|'usize'|'isize'|'f32'|'f64'|'bool'} BaseType */
40
-
41
- /** @typedef {{readonly '*': Type}} Pointer */
42
-
43
- /** @type {(v: string) => string} */
44
- const csUsing = v => `using ${v};`
45
-
46
- /** @type {(type: string) => (name: string) => (body: text.Block) => text.Block} */
47
- const csBlock = type => name => body => [`${type} ${name}`, '{', body, '}']
48
-
49
- /**
50
- * @type {(attributes: list.List<string>) =>
51
- * (type: string) =>
52
- * (name: string) =>
53
- * (body: text.Block) =>
54
- * list.List<text.Item>}
55
- */
56
- const csTypeDef = attributes => type => name => body =>
57
- list.flat([
58
- list.map(v=>`[${v}]`)(attributes),
59
- csBlock(`public ${type}`)(name)(body)
60
- ])
61
-
62
- /** @type {(t: BaseType) => string} */
63
- const csBaseType = t => {
64
- switch (t) {
65
- case 'bool': return 'bool'
66
- case 'f32': return 'float'
67
- case 'f64': return 'double'
68
- case 'i16': return 'short'
69
- case 'i32': return 'int'
70
- case 'i64': return 'long'
71
- case 'i8': return 'sbyte'
72
- case 'isize': return 'IntPtr'
73
- case 'u16': return 'ushort'
74
- case 'u32': return 'uint'
75
- case 'u64': return 'ulong'
76
- case 'u8': return 'byte'
77
- case 'usize': return 'UIntPtr'
78
- }
79
- }
80
-
81
- /** @type {(t: Type) => string} */
82
- const csType = t =>
83
- typeof(t) === 'string' ? csBaseType(t) :
84
- t instanceof Array ? t[0] :
85
- `${csType(t['*'])}*`
86
-
87
- /** @type {(f: Field) => string} */
88
- const csParam = ([name, type]) => `${csType(type)} ${name}`
89
-
90
- /** @type {(f: Field) => string} */
91
- const csField = f => `public ${csParam(f)};`
92
-
93
- /** @type {(m: Method) => string} */
94
- const csResult = m => m.length === 2 ? 'void' : csType(m[2])
95
-
96
- /** @type {(m: Method) => readonly string[]} */
97
- const csMethod = m => [
98
- '[PreserveSig]',
99
- `${csResult(m)} ${m[0]}(${list.join(',')(list.map(csParam)(m[1]))});`
100
- ]
101
-
102
- /** @type {(e: obj.Entry<Definition>) => list.List<text.Item>} */
103
- const csDef = ([n, d]) => {
104
- const i = d.interface
105
- return i === undefined ?
106
- csTypeDef
107
- (['StructLayout(LayoutKind.Sequential)'])
108
- ('struct')
109
- (n)
110
- (() => list.map(csField)(d.struct)) :
111
- csTypeDef
112
- ([`Guid("${d.guid}")`,'InterfaceType(ComInterfaceType.InterfaceIsUnknown)'])
113
- ('interface')
114
- (n)
115
- (() => list.flatMap(csMethod)(d.interface))
116
- }
117
-
118
- /** @type {(name: string) => (library: Library) => text.Block} */
119
- const cs = name => library => {
120
- const v = list.flatMap(csDef)(Object.entries(library))
121
-
122
- /** @type {text.Block} */
123
- const h = [
124
- csUsing('System'),
125
- csUsing('System.Runtime.InteropServices'),
126
- ''
127
- ]
128
-
129
- const ns = csBlock('namespace')(name)(() => v)
130
- return () => list.flat([h, ns])
131
- }
1
+ const types = require('./types/main.f.js');
132
2
 
133
3
  module.exports = {
134
4
  /** @readonly */
135
- cs,
5
+ types,
136
6
  }
@@ -0,0 +1,55 @@
1
+ /** @typedef {{readonly[k in string]: Definition}} Library */
2
+
3
+ /** @typedef {Struct|Interface} Definition */
4
+
5
+ /**
6
+ * @typedef {{
7
+ * readonly interface?: undefined
8
+ * readonly struct: FieldArray
9
+ * }} Struct
10
+ */
11
+
12
+ /** @typedef {readonly Field[]} FieldArray */
13
+
14
+ /** @typedef {readonly[string, Type]} Field */
15
+
16
+ /**
17
+ * @typedef {{
18
+ * readonly interface: MethodArray
19
+ * readonly guid: string
20
+ * }} Interface
21
+ */
22
+
23
+ /** @typedef {readonly Method[]} MethodArray */
24
+
25
+ /** @typedef {readonly[string, FieldArray, Type]} GetMethod */
26
+
27
+ /** @typedef {readonly[string, FieldArray]} SetMethod */
28
+
29
+ /** @typedef {GetMethod|SetMethod} Method */
30
+
31
+ /** @typedef {BaseType|Id|Pointer} Type */
32
+
33
+ /** @typedef {readonly[string]} Id */
34
+
35
+ /**
36
+ * @typedef {|
37
+ * 'u8'|
38
+ * 'i8'|
39
+ * 'u16'|
40
+ * 'i16'|
41
+ * 'u32'|
42
+ * 'i32'|
43
+ * 'u64'|
44
+ * 'i64'|
45
+ * 'usize'|
46
+ * 'isize'|
47
+ * 'f32'|
48
+ * 'f64'|
49
+ * 'bool'
50
+ * } BaseType
51
+ */
52
+
53
+ /** @typedef {{readonly '*': Type}} Pointer */
54
+
55
+ module.exports = {}
@@ -0,0 +1,17 @@
1
+ # Path
2
+
3
+ ## Simplified Common.js
4
+
5
+ A path should be disambiguous.
6
+
7
+ Path limitations:
8
+
9
+ - Accepted file extensions: `.f.js`, `.json`.
10
+ - A file path should be fully specified. For example `../package/dependencies/test.f.js`.
11
+ - A package name can't contain `/`. For example
12
+ - `functionalscript/main.f.js` is allowed.
13
+ - `functionalscript/functionalscript/main.f.js` is not allowed.
14
+
15
+ `package.json` limitations:
16
+
17
+ - Only GitHub packages can be referenced. In the future, we may add generic Git repositories.
@@ -98,11 +98,15 @@ const mapDependency = d => ([external, internal]) => {
98
98
  * (items: list.List<string>) =>
99
99
  * Path|undefined}
100
100
  */
101
- const parseGlobal = d => dir => items => {
102
- const v = variants([undefined, items])
103
- const r = list.first(undefined)(list.filterMap(mapDependency(d))(v))
104
- if (r === undefined) { return undefined }
105
- return { package: r[0], items: list.toArray(r[1]), dir }
101
+ const parseGlobal = dependencies =>
102
+ {
103
+ const filterMap = list.filterMap(mapDependency(dependencies))
104
+ return dir => items => {
105
+ const v = variants([undefined, items])
106
+ const r = list.first(undefined)(filterMap(v))
107
+ if (r === undefined) { return undefined }
108
+ return { package: r[0], items: list.toArray(r[1]), dir }
109
+ }
106
110
  }
107
111
 
108
112
  /**
@@ -112,12 +116,15 @@ const parseGlobal = d => dir => items => {
112
116
  * (path: string) =>
113
117
  * Path|undefined }
114
118
  */
115
- const parse = packageId => dependencies => local => path => {
116
- const parsed = parseLocal(local)(path)
117
- if (parsed === undefined) { return undefined }
118
- const {external, dir, items } = parsed
119
- if (!external) { return { package: packageId, items, dir } }
120
- return parseGlobal(dependencies)(dir)(items)
119
+ const parse = packageId => dependencies => {
120
+ const pg = parseGlobal(dependencies)
121
+ return local => path => {
122
+ const parsed = parseLocal(local)(path)
123
+ if (parsed === undefined) { return undefined }
124
+ const {external, dir, items } = parsed
125
+ if (!external) { return { package: packageId, items, dir } }
126
+ return pg(dir)(items)
127
+ }
121
128
  }
122
129
 
123
130
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.354",
3
+ "version": "0.0.357",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "main.f.js",
6
6
  "scripts": {
package/test.f.js CHANGED
@@ -17,7 +17,8 @@ require('./commonjs/build/test.f.js')
17
17
  require('./types/range/test.f.js')
18
18
  require('./html/test.f.js')
19
19
  require('./text/test.f.js')
20
- require('./com/test.f.js')
20
+ require('./text/encoding/test.f.js')
21
+ require('./com/cs/test.f.js')
21
22
 
22
23
  /** @type {() => never} */
23
24
  const assert = () => { throw 'assert' }
@@ -0,0 +1,40 @@
1
+ const result = require('../../types/result/main.f.js')
2
+ const list = require('../../types/list/main.f.js')
3
+ const { ok, error } = result
4
+
5
+ /** @typedef {result.Result<number,number>} Utf8Result */
6
+
7
+ /** @type {(input:number) => list.List<Utf8Result>} */
8
+ const codePointToUtf8 = input =>
9
+ {
10
+ if (input >= 0x0000 && input <= 0x007f) { return [ok(input & 0x7f)] }
11
+ if (input >= 0x0080 && input <= 0x07ff) { return [ok(input >> 6 | 0xc0), ok(input & 0x3f | 0x80)] }
12
+ if (input >= 0x0800 && input <= 0xffff) { return [ok(input >> 12 | 0xe0), ok(input >> 6 & 0x3f | 0x80), ok(input & 0x3f | 0x80)] }
13
+ if (input >= 0x10000 && input <= 0x10ffff) { return [ok(input >> 18 | 0xf0), ok(input >> 12 & 0x3f | 0x80), ok(input >> 6 & 0x3f | 0x80), ok(input & 0x3f | 0x80)] }
14
+ return [error(input)]
15
+ }
16
+
17
+ /** @type {(input:number) => list.List<Utf8Result>} */
18
+ const codePointToUtf16 = input =>
19
+ {
20
+ if (input >= 0x0000 && input <= 0xd7ff || input >= 0xe000 && input <= 0xffff) { return [ok(input >> 8), ok(input & 0xff)] }
21
+ if (input >= 0x010000 && input <= 0x10ffff) {
22
+ const high = ((input - 0x10000) >> 10) + 0xd800
23
+ const low = ((input - 0x10000) & 0x3ff) + 0xdc00
24
+ return [ok(high >> 8), ok(high & 0xff), ok(low >> 8), ok(low & 0xff)]
25
+ }
26
+ return [error(input)]
27
+ }
28
+
29
+ /** @type {(input: list.List<number>) => list.List<Utf8Result>} */
30
+ const codePointListToUtf8 = list.flatMap(codePointToUtf8)
31
+
32
+ /** @type {(input: list.List<number>) => list.List<Utf8Result>} */
33
+ const codePointListToUtf16 = list.flatMap(codePointToUtf16)
34
+
35
+ module.exports = {
36
+ /** @readonly */
37
+ codePointListToUtf8,
38
+ /** @readonly */
39
+ codePointListToUtf16,
40
+ }
@@ -0,0 +1,119 @@
1
+ const encoding = require('./main.f.js')
2
+ const json = require('../../json/main.f')
3
+ const { sort } = require('../../types/object/main.f.js')
4
+ const { list } = require('../../types/main.f.js')
5
+
6
+ /** @type {(a: readonly json.Unknown[]) => string} */
7
+ const stringify = a => json.stringify(sort)(a)
8
+
9
+ {
10
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0,1,0x7F])))
11
+ if (result !== '[["ok",0],["ok",1],["ok",127]]') { throw result }
12
+ }
13
+
14
+ {
15
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x80])))
16
+ if (result !== '[["ok",194],["ok",128]]') { throw result }
17
+ }
18
+
19
+ {
20
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0xa9])))
21
+ if (result !== '[["ok",194],["ok",169]]') { throw result }
22
+ }
23
+
24
+ {
25
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x7ff])))
26
+ if (result !== '[["ok",223],["ok",191]]') { throw result }
27
+ }
28
+
29
+ {
30
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x800])))
31
+ if (result !== '[["ok",224],["ok",160],["ok",128]]') { throw result }
32
+ }
33
+
34
+ {
35
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x801])))
36
+ if (result !== '[["ok",224],["ok",160],["ok",129]]') { throw result }
37
+ }
38
+
39
+ {
40
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0xffff])))
41
+ if (result !== '[["ok",239],["ok",191],["ok",191]]') { throw result }
42
+ }
43
+
44
+ {
45
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x10000])))
46
+ if (result !== '[["ok",240],["ok",144],["ok",128],["ok",128]]') { throw result }
47
+ }
48
+
49
+ {
50
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x10001])))
51
+ if (result !== '[["ok",240],["ok",144],["ok",128],["ok",129]]') { throw result }
52
+ }
53
+
54
+ {
55
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([0x10FFFF])))
56
+ if (result !== '[["ok",244],["ok",143],["ok",191],["ok",191]]') { throw result }
57
+ }
58
+
59
+ {
60
+ const result = stringify(list.toArray(encoding.codePointListToUtf8([-1,0x110000])))
61
+ if (result !== '[["error",-1],["error",1114112]]') { throw result }
62
+ }
63
+
64
+ {
65
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0])))
66
+ if (result !== '[["ok",0],["ok",0]]') { throw result }
67
+ }
68
+
69
+ {
70
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x24])))
71
+ if (result !== '[["ok",0],["ok",36]]') { throw result }
72
+ }
73
+
74
+ {
75
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x20AC])))
76
+ if (result !== '[["ok",32],["ok",172]]') { throw result }
77
+ }
78
+
79
+ {
80
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0xd7ff])))
81
+ if (result !== '[["ok",215],["ok",255]]') { throw result }
82
+ }
83
+
84
+ {
85
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0xe000])))
86
+ if (result !== '[["ok",224],["ok",0]]') { throw result }
87
+ }
88
+
89
+ {
90
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0xffff])))
91
+ if (result !== '[["ok",255],["ok",255]]') { throw result }
92
+ }
93
+
94
+ {
95
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x10000])))
96
+ if (result !== '[["ok",216],["ok",0],["ok",220],["ok",0]]') { throw result }
97
+ }
98
+
99
+ {
100
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x10437])))
101
+ if (result !== '[["ok",216],["ok",1],["ok",220],["ok",55]]') { throw result }
102
+ }
103
+
104
+ {
105
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x24B62])))
106
+ if (result !== '[["ok",216],["ok",82],["ok",223],["ok",98]]') { throw result }
107
+ }
108
+
109
+ {
110
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([0x10ffff])))
111
+ if (result !== '[["ok",219],["ok",255],["ok",223],["ok",255]]') { throw result }
112
+ }
113
+
114
+ {
115
+ const result = stringify(list.toArray(encoding.codePointListToUtf16([-1, 0xd800, 0xdfff, 0x110000])))
116
+ if (result !== '[["error",-1],["error",55296],["error",57343],["error",1114112]]') { throw result }
117
+ }
118
+
119
+ module.exports = {}