@libraz/coverwise 1.0.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.
Files changed (110) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +119 -0
  3. package/README.npm.md +119 -0
  4. package/dist/coverwise.js +2 -0
  5. package/dist/coverwise.wasm +0 -0
  6. package/dist/js/constraint.d.ts +78 -0
  7. package/dist/js/constraint.d.ts.map +1 -0
  8. package/dist/js/constraint.js +213 -0
  9. package/dist/js/constraint.js.map +1 -0
  10. package/dist/js/index.d.ts +94 -0
  11. package/dist/js/index.d.ts.map +1 -0
  12. package/dist/js/index.js +164 -0
  13. package/dist/js/index.js.map +1 -0
  14. package/dist/js/pure/adapter.d.ts +40 -0
  15. package/dist/js/pure/adapter.d.ts.map +1 -0
  16. package/dist/js/pure/adapter.js +207 -0
  17. package/dist/js/pure/adapter.js.map +1 -0
  18. package/dist/js/pure/index.d.ts +83 -0
  19. package/dist/js/pure/index.d.ts.map +1 -0
  20. package/dist/js/pure/index.js +132 -0
  21. package/dist/js/pure/index.js.map +1 -0
  22. package/dist/js/types.d.ts +132 -0
  23. package/dist/js/types.d.ts.map +1 -0
  24. package/dist/js/types.js +3 -0
  25. package/dist/js/types.js.map +1 -0
  26. package/dist/src/ts/algo/greedy.d.ts +9 -0
  27. package/dist/src/ts/algo/greedy.d.ts.map +1 -0
  28. package/dist/src/ts/algo/greedy.js +137 -0
  29. package/dist/src/ts/algo/greedy.js.map +1 -0
  30. package/dist/src/ts/algo/index.d.ts +2 -0
  31. package/dist/src/ts/algo/index.d.ts.map +1 -0
  32. package/dist/src/ts/algo/index.js +2 -0
  33. package/dist/src/ts/algo/index.js.map +1 -0
  34. package/dist/src/ts/core/coverage-engine.d.ts +40 -0
  35. package/dist/src/ts/core/coverage-engine.d.ts.map +1 -0
  36. package/dist/src/ts/core/coverage-engine.js +366 -0
  37. package/dist/src/ts/core/coverage-engine.js.map +1 -0
  38. package/dist/src/ts/core/generator.d.ts +6 -0
  39. package/dist/src/ts/core/generator.d.ts.map +1 -0
  40. package/dist/src/ts/core/generator.js +394 -0
  41. package/dist/src/ts/core/generator.js.map +1 -0
  42. package/dist/src/ts/core/index.d.ts +3 -0
  43. package/dist/src/ts/core/index.d.ts.map +1 -0
  44. package/dist/src/ts/core/index.js +3 -0
  45. package/dist/src/ts/core/index.js.map +1 -0
  46. package/dist/src/ts/model/boundary.d.ts +29 -0
  47. package/dist/src/ts/model/boundary.d.ts.map +1 -0
  48. package/dist/src/ts/model/boundary.js +102 -0
  49. package/dist/src/ts/model/boundary.js.map +1 -0
  50. package/dist/src/ts/model/constraint-ast.d.ts +152 -0
  51. package/dist/src/ts/model/constraint-ast.d.ts.map +1 -0
  52. package/dist/src/ts/model/constraint-ast.js +384 -0
  53. package/dist/src/ts/model/constraint-ast.js.map +1 -0
  54. package/dist/src/ts/model/constraint-parser.d.ts +49 -0
  55. package/dist/src/ts/model/constraint-parser.d.ts.map +1 -0
  56. package/dist/src/ts/model/constraint-parser.js +831 -0
  57. package/dist/src/ts/model/constraint-parser.js.map +1 -0
  58. package/dist/src/ts/model/error.d.ts +19 -0
  59. package/dist/src/ts/model/error.d.ts.map +1 -0
  60. package/dist/src/ts/model/error.js +19 -0
  61. package/dist/src/ts/model/error.js.map +1 -0
  62. package/dist/src/ts/model/generate-options.d.ts +82 -0
  63. package/dist/src/ts/model/generate-options.d.ts.map +1 -0
  64. package/dist/src/ts/model/generate-options.js +52 -0
  65. package/dist/src/ts/model/generate-options.js.map +1 -0
  66. package/dist/src/ts/model/index.d.ts +6 -0
  67. package/dist/src/ts/model/index.d.ts.map +1 -0
  68. package/dist/src/ts/model/index.js +6 -0
  69. package/dist/src/ts/model/index.js.map +1 -0
  70. package/dist/src/ts/model/parameter.d.ts +65 -0
  71. package/dist/src/ts/model/parameter.d.ts.map +1 -0
  72. package/dist/src/ts/model/parameter.js +157 -0
  73. package/dist/src/ts/model/parameter.js.map +1 -0
  74. package/dist/src/ts/model/test-case.d.ts +67 -0
  75. package/dist/src/ts/model/test-case.d.ts.map +1 -0
  76. package/dist/src/ts/model/test-case.js +28 -0
  77. package/dist/src/ts/model/test-case.js.map +1 -0
  78. package/dist/src/ts/util/bitset.d.ts +14 -0
  79. package/dist/src/ts/util/bitset.d.ts.map +1 -0
  80. package/dist/src/ts/util/bitset.js +66 -0
  81. package/dist/src/ts/util/bitset.js.map +1 -0
  82. package/dist/src/ts/util/combinatorics.d.ts +4 -0
  83. package/dist/src/ts/util/combinatorics.d.ts.map +1 -0
  84. package/dist/src/ts/util/combinatorics.js +60 -0
  85. package/dist/src/ts/util/combinatorics.js.map +1 -0
  86. package/dist/src/ts/util/index.d.ts +5 -0
  87. package/dist/src/ts/util/index.d.ts.map +1 -0
  88. package/dist/src/ts/util/index.js +7 -0
  89. package/dist/src/ts/util/index.js.map +1 -0
  90. package/dist/src/ts/util/rng.d.ts +13 -0
  91. package/dist/src/ts/util/rng.d.ts.map +1 -0
  92. package/dist/src/ts/util/rng.js +112 -0
  93. package/dist/src/ts/util/rng.js.map +1 -0
  94. package/dist/src/ts/util/string_util.d.ts +3 -0
  95. package/dist/src/ts/util/string_util.d.ts.map +1 -0
  96. package/dist/src/ts/util/string_util.js +25 -0
  97. package/dist/src/ts/util/string_util.js.map +1 -0
  98. package/dist/src/ts/validator/constraint-validator.d.ts +34 -0
  99. package/dist/src/ts/validator/constraint-validator.d.ts.map +1 -0
  100. package/dist/src/ts/validator/constraint-validator.js +51 -0
  101. package/dist/src/ts/validator/constraint-validator.js.map +1 -0
  102. package/dist/src/ts/validator/coverage-validator.d.ts +42 -0
  103. package/dist/src/ts/validator/coverage-validator.d.ts.map +1 -0
  104. package/dist/src/ts/validator/coverage-validator.js +230 -0
  105. package/dist/src/ts/validator/coverage-validator.js.map +1 -0
  106. package/dist/src/ts/validator/index.d.ts +3 -0
  107. package/dist/src/ts/validator/index.d.ts.map +1 -0
  108. package/dist/src/ts/validator/index.js +3 -0
  109. package/dist/src/ts/validator/index.js.map +1 -0
  110. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2026 libraz
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # coverwise
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/libraz/coverwise/ci.yml?branch=main&label=CI)](https://github.com/libraz/coverwise/actions)
4
+ [![npm](https://img.shields.io/npm/v/@libraz/coverwise)](https://www.npmjs.com/package/@libraz/coverwise)
5
+ [![codecov](https://codecov.io/gh/libraz/coverwise/branch/main/graph/badge.svg)](https://codecov.io/gh/libraz/coverwise)
6
+ [![License](https://img.shields.io/github/license/libraz/coverwise)](https://github.com/libraz/coverwise/blob/main/LICENSE)
7
+
8
+ Combinatorial test coverage engine via WebAssembly. Analyzes existing tests for coverage gaps, generates minimal test suites, and extends tests incrementally — no native dependencies.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @libraz/coverwise
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ### Analyze existing tests
19
+
20
+ ```typescript
21
+ import { Coverwise } from '@libraz/coverwise';
22
+
23
+ const cw = await Coverwise.create();
24
+
25
+ const report = cw.analyzeCoverage({
26
+ parameters: [
27
+ { name: 'os', values: ['Windows', 'macOS', 'Linux'] },
28
+ { name: 'browser', values: ['Chrome', 'Firefox', 'Safari'] },
29
+ { name: 'env', values: ['staging', 'production'] },
30
+ ],
31
+ tests: myExistingTests,
32
+ });
33
+
34
+ report.coverageRatio; // 0.72
35
+ report.uncovered; // ["os=Linux, browser=Safari", "os=Linux, env=production", ...]
36
+ ```
37
+
38
+ ### Extend with missing coverage
39
+
40
+ ```typescript
41
+ const result = cw.extendTests({
42
+ parameters,
43
+ existing: myExistingTests,
44
+ });
45
+
46
+ result.tests.length - myExistingTests.length; // 3 tests added
47
+ result.coverage; // 1.0
48
+ result.uncovered; // []
49
+ ```
50
+
51
+ ### Generate from scratch
52
+
53
+ ```typescript
54
+ import { when } from '@libraz/coverwise';
55
+
56
+ const result = cw.generate({
57
+ parameters: [
58
+ { name: 'os', values: ['Windows', 'macOS', 'Linux'] },
59
+ { name: 'browser', values: ['Chrome', 'Firefox', 'Safari'] },
60
+ { name: 'theme', values: ['light', 'dark'] },
61
+ ],
62
+ constraints: [
63
+ when('os').eq('Windows').then(when('browser').ne('Safari')).toString(),
64
+ ],
65
+ });
66
+ ```
67
+
68
+ ### Pure TypeScript (no WASM)
69
+
70
+ ```typescript
71
+ import { Coverwise } from '@libraz/coverwise/pure';
72
+
73
+ const cw = await Coverwise.create(); // no WASM loading, returns immediately
74
+ const result = cw.generate({ parameters: [/* ... */] });
75
+ ```
76
+
77
+ ### Browser (CDN)
78
+
79
+ ```html
80
+ <script type="module">
81
+ import { Coverwise } from 'https://esm.sh/@libraz/coverwise';
82
+ const cw = await Coverwise.create();
83
+ const result = cw.generate({ parameters: [/* ... */] });
84
+ </script>
85
+ ```
86
+
87
+ ## API
88
+
89
+ | Method | Description |
90
+ |--------|-------------|
91
+ | `Coverwise.create()` | Create instance (loads WASM once) |
92
+ | `cw.analyzeCoverage(params, tests, strength?)` | Measure t-wise coverage, list uncovered combinations |
93
+ | `cw.extendTests(existing, input)` | Add only the tests needed to close coverage gaps |
94
+ | `cw.generate(input)` | Generate minimal covering array from scratch |
95
+ | `cw.estimateModel(input)` | Preview model statistics |
96
+
97
+ Function-based API (`init()` + `generate()`, `analyzeCoverage()`, ...) is also available.
98
+
99
+ ## Features
100
+
101
+ - **Coverage analysis** — Measure any test suite's t-wise coverage and list every uncovered combination
102
+ - **Incremental extension** — Add only the tests needed to close coverage gaps
103
+ - **Pairwise & t-wise** — 2-wise through arbitrary strength
104
+ - **Constraints** — `IF/THEN/ELSE`, `AND/OR/NOT`, relational, `IN`, `LIKE`
105
+ - **Negative testing** — Auto-generate single-fault tests from `invalid` values
106
+ - **Mixed strength** — Sub-models for critical parameter groups
107
+ - **Boundary values** — Auto-expand integer/float ranges
108
+ - **Equivalence classes** — Class-level coverage tracking
109
+ - **Seed tests** — Build on existing tests incrementally
110
+ - **Deterministic** — Same input + seed = same output
111
+
112
+ ## Requirements
113
+
114
+ - Node.js >= 18 or modern browser with WASM support
115
+ - ESM only (`"type": "module"`)
116
+
117
+ ## License
118
+
119
+ [Apache License 2.0](https://github.com/libraz/coverwise/blob/main/LICENSE)
package/README.npm.md ADDED
@@ -0,0 +1,119 @@
1
+ # coverwise
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/libraz/coverwise/ci.yml?branch=main&label=CI)](https://github.com/libraz/coverwise/actions)
4
+ [![npm](https://img.shields.io/npm/v/@libraz/coverwise)](https://www.npmjs.com/package/@libraz/coverwise)
5
+ [![codecov](https://codecov.io/gh/libraz/coverwise/branch/main/graph/badge.svg)](https://codecov.io/gh/libraz/coverwise)
6
+ [![License](https://img.shields.io/github/license/libraz/coverwise)](https://github.com/libraz/coverwise/blob/main/LICENSE)
7
+
8
+ Combinatorial test coverage engine via WebAssembly. Analyzes existing tests for coverage gaps, generates minimal test suites, and extends tests incrementally — no native dependencies.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @libraz/coverwise
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ### Analyze existing tests
19
+
20
+ ```typescript
21
+ import { Coverwise } from '@libraz/coverwise';
22
+
23
+ const cw = await Coverwise.create();
24
+
25
+ const report = cw.analyzeCoverage({
26
+ parameters: [
27
+ { name: 'os', values: ['Windows', 'macOS', 'Linux'] },
28
+ { name: 'browser', values: ['Chrome', 'Firefox', 'Safari'] },
29
+ { name: 'env', values: ['staging', 'production'] },
30
+ ],
31
+ tests: myExistingTests,
32
+ });
33
+
34
+ report.coverageRatio; // 0.72
35
+ report.uncovered; // ["os=Linux, browser=Safari", "os=Linux, env=production", ...]
36
+ ```
37
+
38
+ ### Extend with missing coverage
39
+
40
+ ```typescript
41
+ const result = cw.extendTests({
42
+ parameters,
43
+ existing: myExistingTests,
44
+ });
45
+
46
+ result.tests.length - myExistingTests.length; // 3 tests added
47
+ result.coverage; // 1.0
48
+ result.uncovered; // []
49
+ ```
50
+
51
+ ### Generate from scratch
52
+
53
+ ```typescript
54
+ import { when } from '@libraz/coverwise';
55
+
56
+ const result = cw.generate({
57
+ parameters: [
58
+ { name: 'os', values: ['Windows', 'macOS', 'Linux'] },
59
+ { name: 'browser', values: ['Chrome', 'Firefox', 'Safari'] },
60
+ { name: 'theme', values: ['light', 'dark'] },
61
+ ],
62
+ constraints: [
63
+ when('os').eq('Windows').then(when('browser').ne('Safari')).toString(),
64
+ ],
65
+ });
66
+ ```
67
+
68
+ ### Pure TypeScript (no WASM)
69
+
70
+ ```typescript
71
+ import { Coverwise } from '@libraz/coverwise/pure';
72
+
73
+ const cw = await Coverwise.create(); // no WASM loading, returns immediately
74
+ const result = cw.generate({ parameters: [/* ... */] });
75
+ ```
76
+
77
+ ### Browser (CDN)
78
+
79
+ ```html
80
+ <script type="module">
81
+ import { Coverwise } from 'https://esm.sh/@libraz/coverwise';
82
+ const cw = await Coverwise.create();
83
+ const result = cw.generate({ parameters: [/* ... */] });
84
+ </script>
85
+ ```
86
+
87
+ ## API
88
+
89
+ | Method | Description |
90
+ |--------|-------------|
91
+ | `Coverwise.create()` | Create instance (loads WASM once) |
92
+ | `cw.analyzeCoverage(params, tests, strength?)` | Measure t-wise coverage, list uncovered combinations |
93
+ | `cw.extendTests(existing, input)` | Add only the tests needed to close coverage gaps |
94
+ | `cw.generate(input)` | Generate minimal covering array from scratch |
95
+ | `cw.estimateModel(input)` | Preview model statistics |
96
+
97
+ Function-based API (`init()` + `generate()`, `analyzeCoverage()`, ...) is also available.
98
+
99
+ ## Features
100
+
101
+ - **Coverage analysis** — Measure any test suite's t-wise coverage and list every uncovered combination
102
+ - **Incremental extension** — Add only the tests needed to close coverage gaps
103
+ - **Pairwise & t-wise** — 2-wise through arbitrary strength
104
+ - **Constraints** — `IF/THEN/ELSE`, `AND/OR/NOT`, relational, `IN`, `LIKE`
105
+ - **Negative testing** — Auto-generate single-fault tests from `invalid` values
106
+ - **Mixed strength** — Sub-models for critical parameter groups
107
+ - **Boundary values** — Auto-expand integer/float ranges
108
+ - **Equivalence classes** — Class-level coverage tracking
109
+ - **Seed tests** — Build on existing tests incrementally
110
+ - **Deterministic** — Same input + seed = same output
111
+
112
+ ## Requirements
113
+
114
+ - Node.js >= 18 or modern browser with WASM support
115
+ - ESM only (`"type": "module"`)
116
+
117
+ ## License
118
+
119
+ [Apache License 2.0](https://github.com/libraz/coverwise/blob/main/LICENSE)
@@ -0,0 +1,2 @@
1
+ async function createCoverwise(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url)}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["D"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("coverwise.wasm")}return new URL("coverwise.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var __abort_js=()=>abort("");var AsciiToString=ptr=>{var str="";while(1){var ch=HEAPU8[ptr++];if(!ch)return str;str+=String.fromCharCode(ch)}};var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var BindingError=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};var throwBindingError=message=>{throw new BindingError(message)};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){return sharedRegisterType(rawType,registeredInstance,options)}var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0n;let fromWireType=value=>value;if(isUnsignedType){const bitSize=size*8;fromWireType=value=>BigInt.asUintN(bitSize,value);maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>{if(typeof value=="number"){value=BigInt(value)}return value},readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},readValueFromPointer:function(pointer){return this.fromWireType(HEAPU8[pointer])},destructorFunction:null})};var emval_freelist=[];var emval_handles=[0,1,,1,null,1,true,1,false,1];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){emval_handles[handle]=undefined;emval_freelist.push(handle)}};var Emval={toValue:handle=>{if(!handle){throwBindingError(`Cannot use deleted val. handle = ${handle}`)}return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};function readPointer(pointer){return this.fromWireType(HEAPU32[pointer>>2])}var EmValType={name:"emscripten::val",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this.fromWireType(HEAPF32[pointer>>2])};case 8:return function(pointer){return this.fromWireType(HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>value,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var createNamedFunction=(name,func)=>Object.defineProperty(func,"name",{value:name});var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function usesDestructorStack(argTypes){for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){return true}}return false}function createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync){var needsDestructorStack=usesDestructorStack(argTypes);var argCount=argTypes.length-2;var argsList=[];var argsListWired=["fn"];if(isClassMethodFunc){argsListWired.push("thisWired")}for(var i=0;i<argCount;++i){argsList.push(`arg${i}`);argsListWired.push(`arg${i}Wired`)}argsList=argsList.join(",");argsListWired=argsListWired.join(",");var invokerFnBody=`return function (${argsList}) {\n`;if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];if(isClassMethodFunc){invokerFnBody+=`var thisWired = toClassParamWire(${dtorStack}, this);\n`}for(var i=0;i<argCount;++i){var argName=`toArg${i}Wire`;invokerFnBody+=`var arg${i}Wired = ${argName}(${dtorStack}, arg${i});\n`;args1.push(argName)}invokerFnBody+=(returns||isAsync?"var rv = ":"")+`invoker(${argsListWired});\n`;if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=`${paramName}_dtor(${paramName});\n`;args1.push(`${paramName}_dtor`)}}}if(returns){invokerFnBody+="var ret = fromRetWire(rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";return new Function(args1,invokerFnBody)}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=usesDestructorStack(argTypes);var returns=!argTypes[0].isVoid;var retType=argTypes[0];var instType=argTypes[1];var closureArgs=[humanName,throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,retType.fromWireType.bind(retType),instType?.toWireType.bind(instType)];for(var i=2;i<argCount;++i){var argType=argTypes[i];closureArgs.push(argType.toWireType.bind(argType))}if(!needsDestructorStack){for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){if(argTypes[i].destructorFunction!==null){closureArgs.push(argTypes[i].destructorFunction)}}}let invokerFactory=createJsInvoker(argTypes,isClassMethodFunc,returns,isAsync);var invokerFn=invokerFactory(...closureArgs);return createNamedFunction(humanName,invokerFn)}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i<count;i++){array.push(HEAPU32[firstElement+i*4>>2])}return array};var InternalError=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};var throwInternalError=message=>{throw new InternalError(message)};var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistent public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var embind__requireFunction=(signature,rawFunction,isAsync=false)=>{signature=AsciiToString(signature);function makeDynCaller(){var rtn=getWasmTableEntry(rawFunction);return rtn}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};class UnboundTypeError extends Error{}var getTypeName=type=>{var ptr=___getTypeName(type);var rv=AsciiToString(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;for(let[i,dt]of dependentTypes.entries()){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}}if(0===unregisteredTypes.length){onComplete(typeConverters)}};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf("(");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex)};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=AsciiToString(name);name=getFunctionName(name);rawInvoker=embind__requireFunction(signature,rawInvoker,isAsync);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0;let fromWireType=value=>value;if(isUnsignedType){var bitshift=32-8*size;fromWireType=value=>value<<bitshift>>>bitshift;maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>value,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=AsciiToString(name);registerType(rawType,{name,fromWireType:decodeMemoryView,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var __embind_register_std_string=(rawType,name)=>{name=AsciiToString(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){str=UTF8ToString(payload,length,true)}else{str="";for(var i=0;i<length;++i){str+=String.fromCharCode(HEAPU8[payload+i])}}_free(value);return str},toWireType(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var length;var valueIsOfTypeString=typeof value=="string";if(!(valueIsOfTypeString||ArrayBuffer.isView(value)&&value.BYTES_PER_ELEMENT==1)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){length=lengthBytesUTF8(value)}else{length=value.length}var base=_malloc(4+length+1);var ptr=base+4;HEAPU32[base>>2]=length;if(valueIsOfTypeString){if(stdStringIsUTF8){stringToUTF8(value,ptr,length+1)}else{for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(base);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}}else{HEAPU8.set(value,ptr)}if(destructors!==null){destructors.push(_free,base)}return base},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=globalThis.TextDecoder?new TextDecoder("utf-16le"):undefined;var UTF16ToString=(ptr,maxBytesToRead,ignoreNul)=>{var idx=ptr>>1;var endIdx=findStringEnd(HEAPU16,idx,maxBytesToRead/2,ignoreNul);if(endIdx-idx>16&&UTF16Decoder)return UTF16Decoder.decode(HEAPU16.subarray(idx,endIdx));var str="";for(var i=idx;i<endIdx;++i){var codeUnit=HEAPU16[i];str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead,ignoreNul)=>{var str="";var startIdx=ptr>>2;for(var i=0;!(i>=maxBytesToRead/4);i++){var utf32=HEAPU32[startIdx+i];if(!utf32&&!ignoreNul)break;str+=String.fromCodePoint(utf32)}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{maxBytesToWrite??=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codePoint=str.codePointAt(i);if(codePoint>65535){i++}HEAP32[outPtr>>2]=codePoint;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i<str.length;++i){var codePoint=str.codePointAt(i);if(codePoint>65535){i++}len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=AsciiToString(name);var decodeString,encodeString,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16}else{decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str=decodeString(value+4,length*charSize,true);_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_void=(rawType,name)=>{name=AsciiToString(name);registerType(rawType,{isVoid:true,name,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var emval_methodCallers=[];var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`)}return impl};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAPU32[argTypes+i*4>>2],`parameter ${i}`)}return a};var emval_returnValue=(toReturnWire,destructorsRef,handle)=>{var destructors=[];var result=toReturnWire(destructors,handle);if(destructors.length){HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors)}return result};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return AsciiToString(address)}return symbol};var __emval_create_invoker=(argCount,argTypesPtr,kind)=>{var GenericWireTypeSize=8;var[retType,...argTypes]=emval_lookupTypes(argCount,argTypesPtr);var toReturnWire=retType.toWireType.bind(retType);var argFromPtr=argTypes.map(type=>type.readValueFromPointer.bind(type));argCount--;var captures={toValue:Emval.toValue};var args=argFromPtr.map((argFromPtr,i)=>{var captureName=`argFromPtr${i}`;captures[captureName]=argFromPtr;return`${captureName}(args${i?"+"+i*GenericWireTypeSize:""})`});var functionBody;switch(kind){case 0:functionBody="toValue(handle)";break;case 2:functionBody="new (toValue(handle))";break;case 3:functionBody="";break;case 1:captures["getStringOrSymbol"]=getStringOrSymbol;functionBody="toValue(handle)[getStringOrSymbol(methodName)]";break}functionBody+=`(${args})`;if(!retType.isVoid){captures["toReturnWire"]=toReturnWire;captures["emval_returnValue"]=emval_returnValue;functionBody=`return emval_returnValue(toReturnWire, destructorsRef, ${functionBody})`}functionBody=`return function (handle, methodName, destructorsRef, args) {\n${functionBody}\n}`;var invokerFunction=new Function(Object.keys(captures),functionBody)(...Object.values(captures));var functionName=`methodCaller<(${argTypes.map(t=>t.name)}) => ${retType.name}>`;return emval_addMethodCaller(createNamedFunction(functionName,invokerFunction))};var __emval_get_global=name=>{if(!name){return Emval.toHandle(globalThis)}name=getStringOrSymbol(name);return Emval.toHandle(globalThis[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>9){emval_handles[handle+1]+=1}};var __emval_invoke=(caller,handle,methodName,destructorsRef,args)=>emval_methodCallers[caller](handle,methodName,destructorsRef,args);var __emval_new_array=()=>Emval.toHandle([]);var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_new_object=()=>Emval.toHandle({});var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var __emval_set_property=(handle,key,value)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value};var __emval_typeof=handle=>{handle=Emval.toValue(handle);return Emval.toHandle(typeof handle)};var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}HEAPU32[penviron_buf_size>>2]=bufSize;return 0};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}var ___getTypeName,_malloc,_free,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){___getTypeName=wasmExports["E"];_malloc=wasmExports["G"];_free=wasmExports["H"];memory=wasmMemory=wasmExports["C"];__indirect_function_table=wasmTable=wasmExports["F"]}var wasmImports={n:___cxa_throw,w:__abort_js,r:__embind_register_bigint,A:__embind_register_bool,y:__embind_register_emval,q:__embind_register_float,l:__embind_register_function,k:__embind_register_integer,i:__embind_register_memory_view,z:__embind_register_std_string,p:__embind_register_std_wstring,B:__embind_register_void,d:__emval_create_invoker,a:__emval_decref,o:__emval_get_global,g:__emval_get_property,f:__emval_incref,c:__emval_invoke,m:__emval_new_array,e:__emval_new_cstring,j:__emval_new_object,b:__emval_run_destructors,h:__emval_set_property,s:__emval_typeof,t:__tzset_js,x:_emscripten_resize_heap,u:_environ_get,v:_environ_sizes_get};function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
2
+ ;return moduleRtn}export default createCoverwise;
Binary file
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Fluent constraint builder for coverwise.
3
+ *
4
+ * Generates constraint strings compatible with the C++ constraint parser.
5
+ *
6
+ * @example
7
+ * import { when, not, allOf, anyOf } from '@libraz/coverwise/constraint';
8
+ *
9
+ * // IF os = Windows THEN browser != Safari
10
+ * when('os').eq('Windows').then(when('browser').ne('Safari'))
11
+ *
12
+ * // NOT (os = win AND browser = safari)
13
+ * not(allOf(when('os').eq('win'), when('browser').eq('safari')))
14
+ */
15
+ /** A condition expression that can be composed with AND/OR or used in IF...THEN. */
16
+ export interface Condition {
17
+ and(other: Condition): Condition;
18
+ or(other: Condition): Condition;
19
+ then(consequence: Condition): Constraint;
20
+ implies(consequence: Condition): Constraint;
21
+ toString(): string;
22
+ }
23
+ /** A complete constraint (IF...THEN with optional ELSE). */
24
+ export interface Constraint {
25
+ else(alternative: Condition): Constraint;
26
+ toString(): string;
27
+ }
28
+ /** Starting point for building a condition on a parameter. */
29
+ export interface ConditionStart {
30
+ eq(value: string | number | boolean): Condition;
31
+ ne(value: string | number | boolean): Condition;
32
+ gt(value: number | string): Condition;
33
+ gte(value: number | string): Condition;
34
+ lt(value: number | string): Condition;
35
+ lte(value: number | string): Condition;
36
+ in(...values: (string | number | boolean)[]): Condition;
37
+ like(pattern: string): Condition;
38
+ }
39
+ /**
40
+ * Start building a condition on a parameter.
41
+ *
42
+ * @param param - The parameter name.
43
+ * @returns A builder for specifying the comparison operator and value.
44
+ *
45
+ * @example
46
+ * when('os').eq('Windows') // os = Windows
47
+ * when('version').gt(3) // version > 3
48
+ * when('start_date').lt('end_date') // start_date < end_date
49
+ */
50
+ export declare function when(param: string): ConditionStart;
51
+ /**
52
+ * Negate a condition.
53
+ *
54
+ * @example
55
+ * not(when('os').eq('win'))
56
+ * // NOT (os = win)
57
+ *
58
+ * not(allOf(when('os').eq('win'), when('browser').eq('safari')))
59
+ * // NOT (os = win AND browser = safari)
60
+ */
61
+ export declare function not(condition: Condition): Condition;
62
+ /**
63
+ * Combine conditions with AND.
64
+ *
65
+ * @example
66
+ * allOf(when('os').eq('win'), when('browser').eq('chrome'))
67
+ * // os = win AND browser = chrome
68
+ */
69
+ export declare function allOf(...conditions: Condition[]): Condition;
70
+ /**
71
+ * Combine conditions with OR.
72
+ *
73
+ * @example
74
+ * anyOf(when('os').eq('win'), when('os').eq('linux'))
75
+ * // os = win OR os = linux
76
+ */
77
+ export declare function anyOf(...conditions: Condition[]): Condition;
78
+ //# sourceMappingURL=constraint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraint.d.ts","sourceRoot":"","sources":["../../js/constraint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA2CH,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC;IACzC,OAAO,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC;IAC5C,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC;IACzC,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAChD,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAChD,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IACxD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AA+HD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAgB,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,CAe3D;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,CAS3D"}