@simtest-js/funnel 1.0.0-beta.10 → 1.0.0-beta.11
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/README.md
CHANGED
|
@@ -20,7 +20,7 @@ pnpm add @simtest-js/funnel
|
|
|
20
20
|
## Quick start
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
-
import { compare, Status } from
|
|
23
|
+
import { compare, Status } from '@simtest-js/funnel';
|
|
24
24
|
|
|
25
25
|
const tRef = Float64Array.from({ length: 101 }, (_, i) => i / 100);
|
|
26
26
|
const yRef = tRef.map((t) => Math.sin(2 * Math.PI * t));
|
|
@@ -31,9 +31,9 @@ const result = compare(tRef, yRef, tRef, yTest, {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
if (result.status === Status.Pass) {
|
|
34
|
-
console.log(
|
|
34
|
+
console.log('inside funnel');
|
|
35
35
|
} else {
|
|
36
|
-
console.log(
|
|
36
|
+
console.log('status:', result.status, 'signed errors:', result.errorsY);
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -45,17 +45,17 @@ above the upper bound, negative below the lower bound.
|
|
|
45
45
|
|
|
46
46
|
Mirror `simtest_funnel_core::Status`:
|
|
47
47
|
|
|
48
|
-
| Name
|
|
49
|
-
|
|
50
|
-
| `Pass`
|
|
51
|
-
| `Fail`
|
|
52
|
-
| `MissingReference`
|
|
53
|
-
| `MissingTest`
|
|
54
|
-
| `NonMonotonic`
|
|
55
|
-
| `LengthMismatch`
|
|
56
|
-
| `EmptyRange`
|
|
57
|
-
| `BufferTooSmall`
|
|
58
|
-
| `InsufficientData`
|
|
48
|
+
| Name | Code |
|
|
49
|
+
| ------------------ | ---: |
|
|
50
|
+
| `Pass` | 0 |
|
|
51
|
+
| `Fail` | -1 |
|
|
52
|
+
| `MissingReference` | 1 |
|
|
53
|
+
| `MissingTest` | 2 |
|
|
54
|
+
| `NonMonotonic` | 10 |
|
|
55
|
+
| `LengthMismatch` | 11 |
|
|
56
|
+
| `EmptyRange` | 12 |
|
|
57
|
+
| `BufferTooSmall` | 13 |
|
|
58
|
+
| `InsufficientData` | 14 |
|
|
59
59
|
|
|
60
60
|
## Reference documentation
|
|
61
61
|
|
|
@@ -40,7 +40,7 @@ export function version() {
|
|
|
40
40
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
export function
|
|
43
|
+
export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
|
|
44
44
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
45
45
|
return ret;
|
|
46
46
|
}
|
|
@@ -48,64 +48,64 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
48
48
|
const ret = String(arg1);
|
|
49
49
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
50
50
|
const len1 = WASM_VECTOR_LEN;
|
|
51
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
52
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
51
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
52
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
53
53
|
}
|
|
54
|
-
export function
|
|
54
|
+
export function __wbg___wbindgen_boolean_get_4f1baf9a00be3c74(arg0) {
|
|
55
55
|
const v = arg0;
|
|
56
56
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
57
57
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
58
58
|
}
|
|
59
|
-
export function
|
|
59
|
+
export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
|
|
60
60
|
const ret = debugString(arg1);
|
|
61
61
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
62
62
|
const len1 = WASM_VECTOR_LEN;
|
|
63
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
64
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
63
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
64
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
65
65
|
}
|
|
66
|
-
export function
|
|
66
|
+
export function __wbg___wbindgen_in_3f58a9d3b3a7eed2(arg0, arg1) {
|
|
67
67
|
const ret = arg0 in arg1;
|
|
68
68
|
return ret;
|
|
69
69
|
}
|
|
70
|
-
export function
|
|
70
|
+
export function __wbg___wbindgen_is_null_c22311b1cc228e3a(arg0) {
|
|
71
71
|
const ret = arg0 === null;
|
|
72
72
|
return ret;
|
|
73
73
|
}
|
|
74
|
-
export function
|
|
74
|
+
export function __wbg___wbindgen_is_object_8b968c3ab8e96595(arg0) {
|
|
75
75
|
const val = arg0;
|
|
76
76
|
const ret = typeof(val) === 'object' && val !== null;
|
|
77
77
|
return ret;
|
|
78
78
|
}
|
|
79
|
-
export function
|
|
79
|
+
export function __wbg___wbindgen_is_undefined_be5b34249ff1fc15(arg0) {
|
|
80
80
|
const ret = arg0 === undefined;
|
|
81
81
|
return ret;
|
|
82
82
|
}
|
|
83
|
-
export function
|
|
83
|
+
export function __wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36(arg0, arg1) {
|
|
84
84
|
const ret = arg0 == arg1;
|
|
85
85
|
return ret;
|
|
86
86
|
}
|
|
87
|
-
export function
|
|
87
|
+
export function __wbg___wbindgen_number_get_934b640d0889af78(arg0, arg1) {
|
|
88
88
|
const obj = arg1;
|
|
89
89
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
90
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
91
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
90
|
+
getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
91
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
|
|
92
92
|
}
|
|
93
|
-
export function
|
|
93
|
+
export function __wbg___wbindgen_string_get_7ce8eee7fd327545(arg0, arg1) {
|
|
94
94
|
const obj = arg1;
|
|
95
95
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
96
96
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
97
97
|
var len1 = WASM_VECTOR_LEN;
|
|
98
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
99
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
98
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
99
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
100
100
|
}
|
|
101
|
-
export function
|
|
101
|
+
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
102
102
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
103
103
|
}
|
|
104
|
-
export function
|
|
104
|
+
export function __wbg_get_with_ref_key_fc601247060b7204(arg0, arg1) {
|
|
105
105
|
const ret = arg0[arg1];
|
|
106
106
|
return ret;
|
|
107
107
|
}
|
|
108
|
-
export function
|
|
108
|
+
export function __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b(arg0) {
|
|
109
109
|
let result;
|
|
110
110
|
try {
|
|
111
111
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -115,7 +115,7 @@ export function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(arg0) {
|
|
|
115
115
|
const ret = result;
|
|
116
116
|
return ret;
|
|
117
117
|
}
|
|
118
|
-
export function
|
|
118
|
+
export function __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea(arg0) {
|
|
119
119
|
let result;
|
|
120
120
|
try {
|
|
121
121
|
result = arg0 instanceof Uint8Array;
|
|
@@ -125,120 +125,112 @@ export function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(arg0) {
|
|
|
125
125
|
const ret = result;
|
|
126
126
|
return ret;
|
|
127
127
|
}
|
|
128
|
-
export function
|
|
128
|
+
export function __wbg_length_186163212ffe79c3(arg0) {
|
|
129
129
|
const ret = arg0.length;
|
|
130
130
|
return ret;
|
|
131
131
|
}
|
|
132
|
-
export function
|
|
132
|
+
export function __wbg_length_5a8bb8abe1e54e15(arg0) {
|
|
133
133
|
const ret = arg0.length;
|
|
134
134
|
return ret;
|
|
135
135
|
}
|
|
136
|
-
export function
|
|
136
|
+
export function __wbg_new_13de428334042d26(arg0) {
|
|
137
137
|
const ret = new Uint8Array(arg0);
|
|
138
138
|
return ret;
|
|
139
139
|
}
|
|
140
|
-
export function
|
|
140
|
+
export function __wbg_new_37eb45aaf5eeb820() {
|
|
141
141
|
const ret = new Array();
|
|
142
142
|
return ret;
|
|
143
143
|
}
|
|
144
|
-
export function
|
|
144
|
+
export function __wbg_new_cd4348290afae586() {
|
|
145
145
|
const ret = new Object();
|
|
146
146
|
return ret;
|
|
147
147
|
}
|
|
148
|
-
export function
|
|
148
|
+
export function __wbg_prototypesetcall_13162965d1fe7aa3(arg0, arg1, arg2) {
|
|
149
149
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
150
150
|
}
|
|
151
|
-
export function
|
|
151
|
+
export function __wbg_prototypesetcall_a366c038a3918afa(arg0, arg1, arg2) {
|
|
152
152
|
Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
|
|
153
153
|
}
|
|
154
|
-
export function
|
|
154
|
+
export function __wbg_set_d2d33b52458e984a(arg0, arg1, arg2) {
|
|
155
155
|
arg0[arg1 >>> 0] = arg2;
|
|
156
156
|
}
|
|
157
|
-
export function
|
|
157
|
+
export function __wbg_set_e4b9a833d288759a(arg0, arg1, arg2) {
|
|
158
158
|
arg0[arg1] = arg2;
|
|
159
159
|
}
|
|
160
|
-
export function
|
|
160
|
+
export function __wbindgen_generic_0000000000000001(arg0) {
|
|
161
161
|
// Cast intrinsic for `F64 -> Externref`.
|
|
162
162
|
const ret = arg0;
|
|
163
163
|
return ret;
|
|
164
164
|
}
|
|
165
|
-
export function
|
|
165
|
+
export function __wbindgen_generic_0000000000000002(arg0, arg1) {
|
|
166
166
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
167
167
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
168
168
|
return ret;
|
|
169
169
|
}
|
|
170
170
|
export function __wbindgen_init_externref_table() {
|
|
171
171
|
const table = wasm.__wbindgen_externrefs;
|
|
172
|
-
const offset = table.grow(4);
|
|
173
172
|
table.set(0, undefined);
|
|
174
|
-
table.set(
|
|
175
|
-
table.set(
|
|
176
|
-
table.set(
|
|
177
|
-
table.set(
|
|
173
|
+
table.set(1024, undefined);
|
|
174
|
+
table.set(1025, null);
|
|
175
|
+
table.set(1026, true);
|
|
176
|
+
table.set(1027, false);
|
|
178
177
|
}
|
|
179
178
|
function debugString(val) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
232
|
-
} catch (_) {
|
|
233
|
-
return 'Object';
|
|
179
|
+
switch (typeof val) {
|
|
180
|
+
// primitive types
|
|
181
|
+
case 'number':
|
|
182
|
+
case 'boolean':
|
|
183
|
+
case 'undefined':
|
|
184
|
+
return `${val}`;
|
|
185
|
+
case 'string':
|
|
186
|
+
return JSON.stringify(val);
|
|
187
|
+
case 'bigint':
|
|
188
|
+
return `${val}n`;
|
|
189
|
+
case 'symbol':
|
|
190
|
+
return val.description !== undefined
|
|
191
|
+
? `Symbol(${val.description})`
|
|
192
|
+
: 'Symbol';
|
|
193
|
+
case 'function':
|
|
194
|
+
return typeof val.name === 'string' && val.name !== ''
|
|
195
|
+
? `Function(${val.name})`
|
|
196
|
+
: 'Function';
|
|
197
|
+
case 'object': {
|
|
198
|
+
if (val === null) {
|
|
199
|
+
return 'null';
|
|
200
|
+
}
|
|
201
|
+
// objects
|
|
202
|
+
if (Array.isArray(val)) {
|
|
203
|
+
return '[' + Array.from(val, debugString).join(', ') + ']';
|
|
204
|
+
}
|
|
205
|
+
// errors
|
|
206
|
+
if (val instanceof Error) {
|
|
207
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const toStringOutput = toString.call(val);
|
|
211
|
+
// Test for built-in
|
|
212
|
+
const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
|
|
213
|
+
|
|
214
|
+
// Failed to match the standard '[object ClassName]'
|
|
215
|
+
if (className === undefined) {
|
|
216
|
+
return toStringOutput;
|
|
217
|
+
}
|
|
218
|
+
if (className === 'Object') {
|
|
219
|
+
// we're a user defined class or Object
|
|
220
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
221
|
+
// easier than looping through ownProperties of `val`.
|
|
222
|
+
try {
|
|
223
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
224
|
+
} catch (_) {
|
|
225
|
+
return 'Object';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
229
|
+
return className;
|
|
234
230
|
}
|
|
231
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
232
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
235
233
|
}
|
|
236
|
-
// errors
|
|
237
|
-
if (val instanceof Error) {
|
|
238
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
239
|
-
}
|
|
240
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
241
|
-
return className;
|
|
242
234
|
}
|
|
243
235
|
|
|
244
236
|
function getArrayF64FromWasm0(ptr, len) {
|
|
@@ -269,7 +261,7 @@ function getFloat64ArrayMemory0() {
|
|
|
269
261
|
|
|
270
262
|
function getStringFromWasm0(ptr, len) {
|
|
271
263
|
ptr = ptr >>> 0;
|
|
272
|
-
return decodeText(ptr, len);
|
|
264
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
273
265
|
}
|
|
274
266
|
|
|
275
267
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -327,18 +319,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
327
319
|
return value;
|
|
328
320
|
}
|
|
329
321
|
|
|
330
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
322
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
331
323
|
cachedTextDecoder.decode();
|
|
332
324
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
333
325
|
let numBytesDecoded = 0;
|
|
334
|
-
function decodeText(
|
|
335
|
-
numBytesDecoded +=
|
|
326
|
+
function decodeText(bytes) {
|
|
327
|
+
numBytesDecoded += bytes.length;
|
|
336
328
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
337
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
329
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
338
330
|
cachedTextDecoder.decode();
|
|
339
|
-
numBytesDecoded =
|
|
331
|
+
numBytesDecoded = bytes.length;
|
|
340
332
|
}
|
|
341
|
-
return cachedTextDecoder.decode(
|
|
333
|
+
return cachedTextDecoder.decode(bytes);
|
|
342
334
|
}
|
|
343
335
|
|
|
344
336
|
const cachedTextEncoder = new TextEncoder();
|
|
Binary file
|
|
@@ -6,7 +6,7 @@ export const defaultOptions: () => any;
|
|
|
6
6
|
export const version: () => [number, number];
|
|
7
7
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
8
8
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
9
10
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
10
11
|
export const __externref_table_dealloc: (a: number) => void;
|
|
11
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
12
12
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simtest-js/funnel",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "Trajectory comparison library (WASM + TypeScript)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,11 +26,10 @@
|
|
|
26
26
|
"docs": "typedoc src/index.ts --out ../../target/doc/js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@biomejs/biome": "^
|
|
30
|
-
"typedoc": "^0.28.
|
|
31
|
-
"typescript": "^
|
|
32
|
-
"vite-plugin-wasm": "^3.
|
|
33
|
-
"
|
|
34
|
-
"vitest": "^1.0.0"
|
|
29
|
+
"@biomejs/biome": "^2.6.8",
|
|
30
|
+
"typedoc": "^0.28.20",
|
|
31
|
+
"typescript": "^6.0.3",
|
|
32
|
+
"vite-plugin-wasm": "^3.6.0",
|
|
33
|
+
"vitest": "^5.1.0"
|
|
35
34
|
}
|
|
36
35
|
}
|