mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-20 08:47:14 +03:00
0ab7a0f9ce
Done using ```bash process() { FILE=$1; awk 'match($0, /^```catala-test *{ *id *= *"(.*)" *}/, a) {print "```catala-test-inline"; f="'"$(dirname $FILE)/output/$(basename $FILE)"'." a[1]; getline; print "$ " $0; while ((getline<f) > 0) print; next} {print}' $FILE >$FILE.new; mv $FILE.new $FILE; } for f in tests/test_*/*/*.catala_* examples/**/*.catala_*; do process $f; git add $f; done for d in $(find -name output -type d); do git rm -r $d; done ```
51 lines
867 B
Plaintext
51 lines
867 B
Plaintext
## Article
|
|
|
|
```catala
|
|
declaration scope A:
|
|
context output x content integer
|
|
|
|
declaration scope B:
|
|
a scope A
|
|
context output y1 content integer
|
|
context output y2 content integer
|
|
|
|
declaration scope C:
|
|
b scope B
|
|
context output z1 content integer
|
|
context output z2 content integer
|
|
|
|
|
|
scope A:
|
|
definition x equals 0
|
|
|
|
scope B:
|
|
definition a.x equals y1
|
|
definition y1 equals 1
|
|
definition y2 equals a.x
|
|
|
|
scope C:
|
|
definition b.y1 equals z1
|
|
definition z1 equals 2
|
|
definition z2 equals b.y2
|
|
```
|
|
|
|
```catala-test-inline
|
|
$ catala Interpret -s A
|
|
[RESULT] Computation successful! Results:
|
|
[RESULT] x = 0
|
|
```
|
|
|
|
```catala-test-inline
|
|
$ catala Interpret -s B
|
|
[RESULT] Computation successful! Results:
|
|
[RESULT] y1 = 1
|
|
[RESULT] y2 = 1
|
|
```
|
|
|
|
```catala-test-inline
|
|
$ catala Interpret -s C
|
|
[RESULT] Computation successful! Results:
|
|
[RESULT] z1 = 2
|
|
[RESULT] z2 = 2
|
|
```
|