mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fixed formatting -> tests update
This commit is contained in:
parent
a5d4f54115
commit
eec5ae54c6
@ -17,16 +17,12 @@ let TestBool : TestBool_in → TestBool =
|
||||
λ (TestBool_in: TestBool_in) →
|
||||
let foo : unit → bool = TestBool_in.foo_in in
|
||||
let bar : unit → integer = TestBool_in.bar_in in
|
||||
let bar1 : integer =
|
||||
error_empty ⟨ bar () | true ⊢ ⟨true ⊢ 1⟩ ⟩
|
||||
in
|
||||
let bar1 : integer = error_empty ⟨ bar () | true ⊢ ⟨true ⊢ 1⟩ ⟩ in
|
||||
let foo1 : bool =
|
||||
error_empty
|
||||
⟨ foo ()
|
||||
| true
|
||||
⊢ ⟨true
|
||||
⊢ ⟨ ⟨bar1 >= 0 ⊢ true⟩, ⟨bar1 < 0 ⊢ false⟩
|
||||
| false ⊢ ∅ ⟩⟩ ⟩
|
||||
⊢ ⟨true ⊢ ⟨ ⟨bar1 >= 0 ⊢ true⟩, ⟨bar1 < 0 ⊢ false⟩ | false ⊢ ∅ ⟩⟩ ⟩
|
||||
in
|
||||
{ TestBool foo = foo1; bar = bar1; }
|
||||
in
|
||||
@ -50,9 +46,7 @@ struct TestBool = {
|
||||
let scope TestBool (foo: bool|context|output) (bar: integer|context|output) =
|
||||
let bar : integer = reentrant or by default ⟨true ⊢ 1⟩;
|
||||
let foo : bool = reentrant or by default
|
||||
⟨true
|
||||
⊢ ⟨ ⟨bar >= 0 ⊢ true⟩, ⟨bar < 0 ⊢ false⟩
|
||||
| false ⊢ ∅ ⟩⟩
|
||||
⟨true ⊢ ⟨ ⟨bar >= 0 ⊢ true⟩, ⟨bar < 0 ⊢ false⟩ | false ⊢ ∅ ⟩⟩
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Interpret_Lcalc -s TestBool --avoid_exceptions --optimize
|
||||
|
@ -26,8 +26,7 @@ $ catala Scopelang -s Foo
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
let scope Foo (x: integer|internal|output) =
|
||||
let x : integer =
|
||||
⟨true ⊢ ⟨ ⟨true ⊢ 1⟩, ⟨true ⊢ 1⟩ | false ⊢ ∅ ⟩⟩
|
||||
let x : integer = ⟨true ⊢ ⟨ ⟨true ⊢ 1⟩, ⟨true ⊢ 1⟩ | false ⊢ ∅ ⟩⟩
|
||||
```
|
||||
|
||||
In Scopelang we have what looks like conflicting exceptions. But after
|
||||
@ -53,9 +52,7 @@ $ catala Dcalc -s Foo
|
||||
└─ Foo
|
||||
let scope Foo (Foo_in: Foo_in): Foo {x: integer} =
|
||||
let set x : integer =
|
||||
error_empty
|
||||
⟨true
|
||||
⊢ ⟨ ⟨ ⟨true ⊢ 1⟩ | true ⊢ 1 ⟩ | false ⊢ ∅ ⟩⟩
|
||||
error_empty ⟨true ⊢ ⟨ ⟨ ⟨true ⊢ 1⟩ | true ⊢ 1 ⟩ | false ⊢ ∅ ⟩⟩
|
||||
in
|
||||
return { Foo x = x; }
|
||||
```
|
||||
|
@ -39,10 +39,8 @@ struct Foo = {
|
||||
|
||||
let scope Foo (y: integer|input) (x: integer|internal|output) =
|
||||
let x : integer =
|
||||
⟨ ⟨ ⟨true
|
||||
⊢ ⟨ ⟨y = 4 ⊢ 4⟩, ⟨y = 5 ⊢ 5⟩ | false ⊢ ∅ ⟩⟩
|
||||
| true
|
||||
⊢ ⟨ ⟨y = 2 ⊢ 2⟩, ⟨y = 3 ⊢ 3⟩ | false ⊢ ∅ ⟩ ⟩
|
||||
⟨ ⟨ ⟨true ⊢ ⟨ ⟨y = 4 ⊢ 4⟩, ⟨y = 5 ⊢ 5⟩ | false ⊢ ∅ ⟩⟩
|
||||
| true ⊢ ⟨ ⟨y = 2 ⊢ 2⟩, ⟨y = 3 ⊢ 3⟩ | false ⊢ ∅ ⟩ ⟩
|
||||
| true ⊢ ⟨ ⟨y = 0 ⊢ 0⟩, ⟨y = 1 ⊢ 1⟩ | false ⊢ ∅ ⟩ ⟩
|
||||
```
|
||||
|
||||
|
@ -38,9 +38,7 @@ let scope A
|
||||
let set e : integer =
|
||||
error_empty ⟨ e () | true ⊢ ⟨true ⊢ b + c + d + 1⟩ ⟩
|
||||
in
|
||||
let set f : integer =
|
||||
error_empty ⟨ f () | true ⊢ ⟨true ⊢ e + 1⟩ ⟩
|
||||
in
|
||||
let set f : integer = error_empty ⟨ f () | true ⊢ ⟨true ⊢ e + 1⟩ ⟩ in
|
||||
return { A b = b; d = d; f = f; }
|
||||
```
|
||||
|
||||
|
@ -73,25 +73,25 @@ $ catala Interpret -t -s HousingComputation
|
||||
error_empty
|
||||
⟨true
|
||||
⊢ (let result : RentComputation =
|
||||
(λ (RentComputation_in: RentComputation_in) →
|
||||
let g : integer → integer =
|
||||
λ (x1: integer) →
|
||||
error_empty ⟨true ⊢ x1 + 1⟩
|
||||
in
|
||||
let f : integer → integer =
|
||||
λ (x1: integer) →
|
||||
error_empty ⟨true ⊢ g (x1 + 1)⟩
|
||||
in
|
||||
{ RentComputation f = f; })
|
||||
{RentComputation_in}
|
||||
in
|
||||
let result1 : RentComputation =
|
||||
{ RentComputation
|
||||
f = λ (param0: integer) → result.f param0;
|
||||
}
|
||||
in
|
||||
if true then result1 else result1).
|
||||
f
|
||||
x⟩
|
||||
(λ (RentComputation_in: RentComputation_in) →
|
||||
let g : integer → integer =
|
||||
λ (x1: integer) →
|
||||
error_empty ⟨true ⊢ x1 + 1⟩
|
||||
in
|
||||
let f : integer → integer =
|
||||
λ (x1: integer) →
|
||||
error_empty ⟨true ⊢ g (x1 + 1)⟩
|
||||
in
|
||||
{ RentComputation f = f; })
|
||||
{RentComputation_in}
|
||||
in
|
||||
let result1 : RentComputation =
|
||||
{ RentComputation
|
||||
f = λ (param0: integer) → result.f param0;
|
||||
}
|
||||
in
|
||||
if true then result1 else result1).
|
||||
f
|
||||
x⟩
|
||||
[RESULT] result = 3
|
||||
```
|
||||
|
@ -27,14 +27,12 @@ $ catala Interpret -s RentComputation
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] f1 = λ (x: integer) →
|
||||
error_empty
|
||||
⟨true
|
||||
⊢ let x1 : integer = x + 1 in
|
||||
error_empty ⟨true ⊢ x1 + 1⟩⟩
|
||||
⟨true ⊢ let x1 : integer = x + 1 in
|
||||
error_empty ⟨true ⊢ x1 + 1⟩⟩
|
||||
[RESULT] f2 = λ (x: integer) →
|
||||
error_empty
|
||||
⟨true
|
||||
⊢ let x1 : integer = x + 1 in
|
||||
error_empty ⟨true ⊢ x1 + 1⟩⟩
|
||||
⟨true ⊢ let x1 : integer = x + 1 in
|
||||
error_empty ⟨true ⊢ x1 + 1⟩⟩
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
|
Loading…
Reference in New Issue
Block a user