pwtg
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -6,3 +6,3 @@ export default class PictGenerator { | ||
constructor(filepathModel: string, pictBinaryLocation: string); | ||
generate(output: "json" | "text", save?: boolean, saveLocation?: string, seedLocation?: string): Promise<void>; | ||
generate(output: "json" | "text", save?: boolean, saveLocation?: string, seedLocation?: string, combinationsOrder?: number): Promise<void>; | ||
private _prepArgs; | ||
@@ -9,0 +9,0 @@ private _resolveToFullpath; |
@@ -8,2 +8,3 @@ import { promisify } from "node:util"; | ||
const sParser = z.string(); | ||
const nParser = z.number(); | ||
export default class PictGenerator { | ||
@@ -18,4 +19,4 @@ filepathModel; | ||
} | ||
async generate(output, save, saveLocation, seedLocation) { | ||
const args = this._prepArgs(output, seedLocation); | ||
async generate(output, save, saveLocation, seedLocation, combinationsOrder) { | ||
const args = this._prepArgs(output, seedLocation, combinationsOrder); | ||
const { stdout } = await exFile(this.pictLocation, [ | ||
@@ -36,6 +37,7 @@ this.filepathModel, | ||
} | ||
_prepArgs(outputType, seedLocation) { | ||
_prepArgs(outputType, seedLocation, combinationsOrder) { | ||
const input = [ | ||
sParser.parse(outputType), | ||
sParser.optional().parse(seedLocation), | ||
nParser.optional().parse(combinationsOrder), | ||
]; | ||
@@ -48,4 +50,7 @@ const output = []; | ||
else if (i === 1 && typeof input[i] !== "undefined") { | ||
output.push(`-e:${this._resolveToFullpath(input[i])}`); | ||
output.push(`-e:${this._resolveToFullpath(seedLocation)}`); | ||
} | ||
else if (i === 2 && typeof input[i] !== "undefined") { | ||
output.push(`-o:${combinationsOrder}`); | ||
} | ||
} | ||
@@ -52,0 +57,0 @@ return output; |
{ | ||
"name": "pwtg", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Node.js Typescript wrapper for using Microsoft PICT programmatically.", | ||
@@ -15,4 +15,3 @@ "repository": { | ||
"build": "rimraf ./dist && tsc", | ||
"lint": "tsc --noEmit --pretty && eslint ./src", | ||
"publish": "npm publish --access-public" | ||
"lint": "tsc --noEmit --pretty && eslint ./src" | ||
}, | ||
@@ -19,0 +18,0 @@ "keywords": [ |
@@ -81,1 +81,31 @@ # PWTG - PairWise Test Generator | ||
``` | ||
### Generate output using different combinatorial order | ||
For pair-wise approach, the (default) value of combinatorial | ||
order is set to `2`. | ||
However, you can set different order, as specified [HERE](https://github.com/microsoft/pict/blob/main/doc/pict.md#usage). | ||
Simply put, the higher combinatorial order you set, the higher coverage | ||
of possible combinations you get. | ||
**Beware: if you set combinatorial order HIGHER then the highest number | ||
of parameters, you will get an error** | ||
```ts | ||
import PictGenerator from "pwtg"; | ||
const generator = new Generator( | ||
"path/to/input-model-file.txt", | ||
"path/to/pict/binary", | ||
); | ||
await generator.generate( | ||
"text", | ||
true, | ||
"path/to/output-text-file.txt", | ||
undefined, | ||
3, | ||
); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
15123
133
111