@under18dev/veritas-property-testing 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/README.md +12 -2
- package/dist/generate.d.ts +20 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +203 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/run.d.ts +42 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +347 -0
- package/dist/run.js.map +1 -0
- package/dist/runner.d.ts +2 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +253 -0
- package/dist/runner.js.map +1 -0
- package/dist/schema.d.ts +78 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +42 -0
- package/dist/schema.js.map +1 -0
- package/package.json +27 -3
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PbtStatus: z.ZodEnum<{
|
|
3
|
+
passed: "passed";
|
|
4
|
+
counterexample: "counterexample";
|
|
5
|
+
error: "error";
|
|
6
|
+
timeout: "timeout";
|
|
7
|
+
cancelled: "cancelled";
|
|
8
|
+
}>;
|
|
9
|
+
export type PbtStatus = z.infer<typeof PbtStatus>;
|
|
10
|
+
/** A passing random run is empirical evidence only; it never yields a proven status. */
|
|
11
|
+
export declare const PbtTrust: z.ZodEnum<{
|
|
12
|
+
empirically_supported: "empirically_supported";
|
|
13
|
+
falsified: "falsified";
|
|
14
|
+
unknown: "unknown";
|
|
15
|
+
}>;
|
|
16
|
+
export type PbtTrust = z.infer<typeof PbtTrust>;
|
|
17
|
+
/** Concrete input: integers as decimal strings, booleans as booleans. */
|
|
18
|
+
export declare const PbtInput: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
|
|
19
|
+
export type PbtInput = z.infer<typeof PbtInput>;
|
|
20
|
+
/**
|
|
21
|
+
* Why an input falsified the property:
|
|
22
|
+
* - `property_violated`: every bound function returned a valid value but the property body was false
|
|
23
|
+
* - `non_integer_result` / `non_boolean_result`: a bound JavaScript function returned a value outside its
|
|
24
|
+
* IR sort (NaN, 1.5, a string, ...); it is never coerced. `-0` is a safe integer and is read as `0`.
|
|
25
|
+
* - `threw`: a bound JavaScript function threw (including permission-model denials)
|
|
26
|
+
* - `model_error`: the IR itself could not be evaluated for this input (status `error`, not a falsification)
|
|
27
|
+
*/
|
|
28
|
+
export declare const PbtFailure: z.ZodObject<{
|
|
29
|
+
reason: z.ZodString;
|
|
30
|
+
javascript: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
+
expected: z.ZodOptional<z.ZodUnknown>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type PbtFailure = z.infer<typeof PbtFailure>;
|
|
34
|
+
export declare const PbtResult: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
propertyId: z.ZodString;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
passed: "passed";
|
|
39
|
+
counterexample: "counterexample";
|
|
40
|
+
error: "error";
|
|
41
|
+
timeout: "timeout";
|
|
42
|
+
cancelled: "cancelled";
|
|
43
|
+
}>;
|
|
44
|
+
trust: z.ZodEnum<{
|
|
45
|
+
empirically_supported: "empirically_supported";
|
|
46
|
+
falsified: "falsified";
|
|
47
|
+
unknown: "unknown";
|
|
48
|
+
}>;
|
|
49
|
+
seed: z.ZodNumber;
|
|
50
|
+
numRuns: z.ZodNumber;
|
|
51
|
+
runsExecuted: z.ZodNullable<z.ZodNumber>;
|
|
52
|
+
counterexample: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
53
|
+
originalCounterexample: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
54
|
+
shrinks: z.ZodNumber;
|
|
55
|
+
path: z.ZodNullable<z.ZodString>;
|
|
56
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
57
|
+
reason: z.ZodString;
|
|
58
|
+
javascript: z.ZodOptional<z.ZodUnknown>;
|
|
59
|
+
expected: z.ZodOptional<z.ZodUnknown>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
domains: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
sort: z.ZodLiteral<"int">;
|
|
64
|
+
domain: z.ZodObject<{
|
|
65
|
+
min: z.ZodString;
|
|
66
|
+
max: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
sort: z.ZodLiteral<"bool">;
|
|
71
|
+
}, z.core.$strip>], "sort">>;
|
|
72
|
+
experimental: z.ZodBoolean;
|
|
73
|
+
replayCommand: z.ZodString;
|
|
74
|
+
durationMs: z.ZodNumber;
|
|
75
|
+
error: z.ZodNullable<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type PbtResult = z.infer<typeof PbtResult>;
|
|
78
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;;;EAAwE,CAAC;AAC/F,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,wFAAwF;AACxF,eAAO,MAAM,QAAQ;;;;EAA4D,CAAC;AAClF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,yEAAyE;AACzE,eAAO,MAAM,QAAQ,4EAA4E,CAAC;AAClG,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;iBAIrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Param } from '@under18dev/veritas-core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const PbtStatus = z.enum(['passed', 'counterexample', 'error', 'timeout', 'cancelled']);
|
|
4
|
+
/** A passing random run is empirical evidence only; it never yields a proven status. */
|
|
5
|
+
export const PbtTrust = z.enum(['empirically_supported', 'falsified', 'unknown']);
|
|
6
|
+
/** Concrete input: integers as decimal strings, booleans as booleans. */
|
|
7
|
+
export const PbtInput = z.record(z.string(), z.union([z.string().regex(/^-?\d+$/), z.boolean()]));
|
|
8
|
+
/**
|
|
9
|
+
* Why an input falsified the property:
|
|
10
|
+
* - `property_violated`: every bound function returned a valid value but the property body was false
|
|
11
|
+
* - `non_integer_result` / `non_boolean_result`: a bound JavaScript function returned a value outside its
|
|
12
|
+
* IR sort (NaN, 1.5, a string, ...); it is never coerced. `-0` is a safe integer and is read as `0`.
|
|
13
|
+
* - `threw`: a bound JavaScript function threw (including permission-model denials)
|
|
14
|
+
* - `model_error`: the IR itself could not be evaluated for this input (status `error`, not a falsification)
|
|
15
|
+
*/
|
|
16
|
+
export const PbtFailure = z.object({
|
|
17
|
+
reason: z.string().min(1),
|
|
18
|
+
javascript: z.unknown().optional(),
|
|
19
|
+
expected: z.unknown().optional(),
|
|
20
|
+
});
|
|
21
|
+
export const PbtResult = z.object({
|
|
22
|
+
id: z.string().min(1),
|
|
23
|
+
propertyId: z.string().min(1),
|
|
24
|
+
status: PbtStatus,
|
|
25
|
+
trust: PbtTrust,
|
|
26
|
+
seed: z.number().int(),
|
|
27
|
+
numRuns: z.number().int().positive(),
|
|
28
|
+
/** Runs fast-check reports as executed; null when the run did not complete (timeout, cancel, error). */
|
|
29
|
+
runsExecuted: z.number().int().nonnegative().nullable(),
|
|
30
|
+
counterexample: PbtInput.nullable(),
|
|
31
|
+
originalCounterexample: PbtInput.nullable(),
|
|
32
|
+
shrinks: z.number().int().nonnegative(),
|
|
33
|
+
/** fast-check replay path of the shrunk counterexample. */
|
|
34
|
+
path: z.string().nullable(),
|
|
35
|
+
failure: PbtFailure.nullable(),
|
|
36
|
+
domains: z.array(Param),
|
|
37
|
+
experimental: z.boolean(),
|
|
38
|
+
replayCommand: z.string().min(1),
|
|
39
|
+
durationMs: z.number().nonnegative(),
|
|
40
|
+
error: z.string().nullable(),
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAG/F,wFAAwF;AACxF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,uBAAuB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAGlF,yEAAyE;AACzE,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,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC9B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACvB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@under18dev/veritas-property-testing",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Property-based testing (fast-check) for Veritas properties, in a restricted process",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/under18dev/veritas.git",
|
|
9
|
+
"directory": "packages/property-testing"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=24"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@under18dev/veritas-core": "0.1.0",
|
|
26
|
+
"@under18dev/veritas-formal-core": "0.1.0",
|
|
27
|
+
"fast-check": "4.10.3",
|
|
28
|
+
"zod": "4.6.7"
|
|
29
|
+
}
|
|
6
30
|
}
|