Skip to content

Commit 4af1dd8

Browse files
committed
Ensure ITF is produced also on successful runs
1 parent cdf353d commit 4af1dd8

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

quint/io-cli-tests.md

+19
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,25 @@ rm out-itf-example.itf.json
683683
]
684684
```
685685

686+
### Run without violation outputs ITF
687+
688+
<!-- !test in sucessful run itf -->
689+
```
690+
quint run --out-itf=out-itf-example.itf.json --max-steps=5 --seed=123 ../examples/solidity/Coin/coin.qnt
691+
cat out-itf-example.itf.json | jq '.states[0]."balances"."#map"[0]'
692+
rm out-itf-example.itf.json
693+
```
694+
695+
<!-- !test out sucessful run itf -->
696+
```
697+
[
698+
"alice",
699+
{
700+
"#bigint": "0"
701+
}
702+
]
703+
```
704+
686705
### Test outputs ITF
687706

688707
TODO: output states after fix: https://github.com/informalsystems/quint/issues/288

quint/src/cliCommands.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,16 @@ export async function runSimulator(prev: TypecheckedStage): Promise<CLIProcedure
549549

550550
const elapsedMs = Date.now() - startMs
551551

552+
if (prev.args.outItf) {
553+
const trace = toItf(result.vars, result.states)
554+
if (trace.isRight()) {
555+
const jsonObj = addItfHeader(prev.args.input, result.outcome.status, trace.value)
556+
writeToJson(prev.args.outItf, jsonObj)
557+
} else {
558+
return cliErr(`ITF conversion failed: ${trace.value}`, { ...simulator, errors: [] })
559+
}
560+
}
561+
552562
switch (result.outcome.status) {
553563
case 'error':
554564
return cliErr('Runtime error', {
@@ -585,16 +595,6 @@ export async function runSimulator(prev: TypecheckedStage): Promise<CLIProcedure
585595
}
586596
}
587597

588-
if (prev.args.outItf) {
589-
const trace = toItf(result.vars, result.states)
590-
if (trace.isRight()) {
591-
const jsonObj = addItfHeader(prev.args.input, result.outcome.status, trace.value)
592-
writeToJson(prev.args.outItf, jsonObj)
593-
} else {
594-
return cliErr(`ITF conversion failed: ${trace.value}`, { ...simulator, errors: [] })
595-
}
596-
}
597-
598598
return cliErr('Invariant violated', {
599599
...simulator,
600600
status: result.outcome.status,

0 commit comments

Comments
 (0)