2022-01-11 18:13:34 +03:00
|
|
|
## Test
|
|
|
|
|
|
|
|
```catala
|
|
|
|
declaration enumeration T:
|
|
|
|
-- C content boolean
|
|
|
|
-- D content integer
|
|
|
|
|
|
|
|
declaration enumeration S:
|
|
|
|
-- A content integer
|
|
|
|
-- B content T
|
|
|
|
|
|
|
|
declaration scope A:
|
2023-06-03 19:02:57 +03:00
|
|
|
output x content integer
|
|
|
|
internal y content S
|
2022-01-11 18:13:34 +03:00
|
|
|
|
|
|
|
scope A:
|
|
|
|
definition y equals B content (D content 1)
|
|
|
|
definition x under condition match y with pattern -- A of a: true -- B of b: false consequence equals 0
|
|
|
|
definition x under condition match y with pattern -- A of a: false -- B of b: true consequence equals 1
|
2022-07-08 17:23:09 +03:00
|
|
|
```
|
2023-12-05 18:56:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
```catala-test-inline
|
2023-12-05 14:00:15 +03:00
|
|
|
$ catala Typecheck --check-invariants
|
2024-05-03 13:20:09 +03:00
|
|
|
┌─[WARNING]─
|
|
|
|
│
|
|
|
|
│ The constructor "C" of enumeration "T" is never used;
|
|
|
|
│ maybe it's unnecessary?
|
|
|
|
│
|
|
|
|
├─➤ tests/proof/good/enums.catala_en:5.7-5.8:
|
|
|
|
│ │
|
|
|
|
│ 5 │ -- C content boolean
|
|
|
|
│ │ ‾
|
|
|
|
└─ Test
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ All invariant checks passed
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ Typechecking successful!
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
2023-12-05 18:56:59 +03:00
|
|
|
```
|
|
|
|
|
2022-09-23 15:04:13 +03:00
|
|
|
```catala-test-inline
|
2023-12-05 14:00:15 +03:00
|
|
|
$ catala Proof --disable-counterexamples
|
2024-05-03 13:20:09 +03:00
|
|
|
┌─[WARNING]─
|
|
|
|
│
|
|
|
|
│ The constructor "C" of enumeration "T" is never used;
|
|
|
|
│ maybe it's unnecessary?
|
|
|
|
│
|
|
|
|
├─➤ tests/proof/good/enums.catala_en:5.7-5.8:
|
|
|
|
│ │
|
|
|
|
│ 5 │ -- C content boolean
|
|
|
|
│ │ ‾
|
|
|
|
└─ Test
|
|
|
|
┌─[RESULT]─
|
2024-05-03 16:12:52 +03:00
|
|
|
│ No errors found during the proof mode run.
|
2024-05-03 13:20:09 +03:00
|
|
|
└─
|
2022-07-08 17:23:09 +03:00
|
|
|
```
|