mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 22:16:10 +03:00
fixing more tests
This commit is contained in:
parent
91805bfa43
commit
5f3584c94d
@ -13,16 +13,11 @@ scope TestBool:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc
|
||||
let TestBool :
|
||||
TestBool_in {"foo_in": unit → bool; "bar_in": unit → integer} →
|
||||
TestBool {"foo": bool; "bar": integer} =
|
||||
λ (TestBool_in: TestBool_in {"foo_in": unit → bool; "bar_in":
|
||||
unit → integer}) →
|
||||
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 ⊢ 1 ⟩ in
|
||||
let foo1 : bool =
|
||||
error_empty
|
||||
⟨ foo ()
|
||||
@ -30,7 +25,7 @@ let TestBool :
|
||||
⊢ ⟨ ⟨bar1 >=! 0 ⊢ true⟩, ⟨bar1 <! 0 ⊢ false⟩
|
||||
| false ⊢ ∅ ⟩ ⟩
|
||||
in
|
||||
{TestBool "foo" = foo1; "bar" = bar1}
|
||||
{ "foo" = foo1; "bar" = bar1}_TestBool
|
||||
in
|
||||
TestBool
|
||||
```
|
||||
@ -50,7 +45,7 @@ struct TestBool = {
|
||||
}
|
||||
|
||||
let scope TestBool (foo: bool|context|output) (bar: integer|context|output) =
|
||||
let bar : integer = reentrant or by default ⟨true ⊢ 1⟩;
|
||||
let bar : integer = reentrant or by default 1;
|
||||
let foo : bool = reentrant or by default
|
||||
⟨ ⟨bar >=! 0 ⊢ true⟩, ⟨bar <! 0 ⊢ false⟩
|
||||
| false ⊢ ∅ ⟩
|
||||
|
@ -50,5 +50,5 @@ scope Benefit:
|
||||
$ catala Interpret -s Benefit
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] benefit = $2000.00
|
||||
[RESULT] person = {Person "age" = 26; "disabled" = true}
|
||||
[RESULT] person = { "age" = 26; "disabled" = true}_Person
|
||||
```
|
||||
|
@ -109,16 +109,10 @@ let glob5_6 = glob5_aux_5 ()
|
||||
|
||||
let glob2_10 = A {"y": glob1_2 >=. 30., "z": 123. *. 17.}
|
||||
|
||||
let S2_6 (S2_in_11: S2_in {}) =
|
||||
let S2_6 (S2_in_11: S2_in) =
|
||||
decl temp_a_13 : any;
|
||||
try:
|
||||
decl temp_a_16 : any;
|
||||
let temp_a_16 (__17 : unit) =
|
||||
return glob3_3 $44.00 +. 100.;
|
||||
decl temp_a_14 : any;
|
||||
let temp_a_14 (__15 : unit) =
|
||||
return true;
|
||||
temp_a_13 = handle_default_1 [] temp_a_14 temp_a_16
|
||||
temp_a_13 = glob3_3 $44.00 +. 100.
|
||||
with EmptyError:
|
||||
temp_a_13 = dead_value_1;
|
||||
raise NoValueProvided;
|
||||
@ -126,70 +120,46 @@ let S2_6 (S2_in_11: S2_in {}) =
|
||||
a_12 = temp_a_13;
|
||||
return S2 {"a": a_12}
|
||||
|
||||
let S3_7 (S3_in_18: S3_in {}) =
|
||||
decl temp_a_20 : any;
|
||||
let S3_7 (S3_in_14: S3_in) =
|
||||
decl temp_a_16 : any;
|
||||
try:
|
||||
decl temp_a_23 : any;
|
||||
let temp_a_23 (__24 : unit) =
|
||||
return 50. +. glob4_4 $44.00 55.;
|
||||
decl temp_a_21 : any;
|
||||
let temp_a_21 (__22 : unit) =
|
||||
return true;
|
||||
temp_a_20 = handle_default_1 [] temp_a_21 temp_a_23
|
||||
temp_a_16 = 50. +. glob4_4 $44.00 55.
|
||||
with EmptyError:
|
||||
temp_a_20 = dead_value_1;
|
||||
temp_a_16 = dead_value_1;
|
||||
raise NoValueProvided;
|
||||
decl a_19 : decimal;
|
||||
a_19 = temp_a_20;
|
||||
return S3 {"a": a_19}
|
||||
decl a_15 : decimal;
|
||||
a_15 = temp_a_16;
|
||||
return S3 {"a": a_15}
|
||||
|
||||
let S4_8 (S4_in_25: S4_in {}) =
|
||||
decl temp_a_27 : any;
|
||||
let S4_8 (S4_in_17: S4_in) =
|
||||
decl temp_a_19 : any;
|
||||
try:
|
||||
decl temp_a_30 : any;
|
||||
let temp_a_30 (__31 : unit) =
|
||||
return glob5_6 +. 1.;
|
||||
decl temp_a_28 : any;
|
||||
let temp_a_28 (__29 : unit) =
|
||||
return true;
|
||||
temp_a_27 = handle_default_1 [] temp_a_28 temp_a_30
|
||||
temp_a_19 = glob5_6 +. 1.
|
||||
with EmptyError:
|
||||
temp_a_27 = dead_value_1;
|
||||
temp_a_19 = dead_value_1;
|
||||
raise NoValueProvided;
|
||||
decl a_26 : decimal;
|
||||
a_26 = temp_a_27;
|
||||
return S4 {"a": a_26}
|
||||
decl a_18 : decimal;
|
||||
a_18 = temp_a_19;
|
||||
return S4 {"a": a_18}
|
||||
|
||||
let S_9 (S_in_32: S_in {}) =
|
||||
decl temp_a_40 : any;
|
||||
let S_9 (S_in_20: S_in) =
|
||||
decl temp_a_24 : any;
|
||||
try:
|
||||
decl temp_a_43 : any;
|
||||
let temp_a_43 (__44 : unit) =
|
||||
return glob1_2 *. glob1_2;
|
||||
decl temp_a_41 : any;
|
||||
let temp_a_41 (__42 : unit) =
|
||||
return true;
|
||||
temp_a_40 = handle_default_1 [] temp_a_41 temp_a_43
|
||||
temp_a_24 = glob1_2 *. glob1_2
|
||||
with EmptyError:
|
||||
temp_a_40 = dead_value_1;
|
||||
temp_a_24 = dead_value_1;
|
||||
raise NoValueProvided;
|
||||
decl a_33 : decimal;
|
||||
a_33 = temp_a_40;
|
||||
decl temp_b_35 : any;
|
||||
decl a_21 : decimal;
|
||||
a_21 = temp_a_24;
|
||||
decl temp_b_23 : any;
|
||||
try:
|
||||
decl temp_b_38 : any;
|
||||
let temp_b_38 (__39 : unit) =
|
||||
return glob2_10;
|
||||
decl temp_b_36 : any;
|
||||
let temp_b_36 (__37 : unit) =
|
||||
return true;
|
||||
temp_b_35 = handle_default_1 [] temp_b_36 temp_b_38
|
||||
temp_b_23 = glob2_10
|
||||
with EmptyError:
|
||||
temp_b_35 = dead_value_1;
|
||||
temp_b_23 = dead_value_1;
|
||||
raise NoValueProvided;
|
||||
decl b_34 : A {"y": bool; "z": decimal};
|
||||
b_34 = temp_b_35;
|
||||
return S {"a": a_33, "b": b_34}
|
||||
decl b_22 : A;
|
||||
b_22 = temp_b_23;
|
||||
return S {"a": a_21, "b": b_22}
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
@ -374,101 +344,60 @@ glob2 = (
|
||||
|
||||
def s2(s2_in:S2In):
|
||||
try:
|
||||
def temp_a(_:Unit):
|
||||
return (glob3(money_of_cents_string("4400")) +
|
||||
decimal_of_string("100."))
|
||||
def temp_a_1(_:Unit):
|
||||
return True
|
||||
temp_a_2 = handle_default(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=37, start_column=10,
|
||||
end_line=37, end_column=11,
|
||||
law_headings=["Test toplevel function defs"]), [],
|
||||
temp_a_1, temp_a)
|
||||
temp_a = (glob3(money_of_cents_string("4400")) +
|
||||
decimal_of_string("100."))
|
||||
except EmptyError:
|
||||
temp_a_2 = dead_value
|
||||
temp_a = dead_value
|
||||
raise NoValueProvided(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=37, start_column=10,
|
||||
end_line=37, end_column=11,
|
||||
law_headings=["Test toplevel function defs"]))
|
||||
a = temp_a_2
|
||||
a = temp_a
|
||||
return S2(a = a)
|
||||
|
||||
def s3(s3_in:S3In):
|
||||
try:
|
||||
def temp_a_3(_:Unit):
|
||||
return (decimal_of_string("50.") +
|
||||
glob4(money_of_cents_string("4400"),
|
||||
decimal_of_string("55.")))
|
||||
def temp_a_4(_:Unit):
|
||||
return True
|
||||
temp_a_5 = handle_default(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=57, start_column=10,
|
||||
end_line=57, end_column=11,
|
||||
law_headings=["Test function def with two args"]), [],
|
||||
temp_a_4, temp_a_3)
|
||||
temp_a_1 = (decimal_of_string("50.") +
|
||||
glob4(money_of_cents_string("4400"), decimal_of_string("55.")))
|
||||
except EmptyError:
|
||||
temp_a_5 = dead_value
|
||||
temp_a_1 = dead_value
|
||||
raise NoValueProvided(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=57, start_column=10,
|
||||
end_line=57, end_column=11,
|
||||
law_headings=["Test function def with two args"]))
|
||||
a_1 = temp_a_5
|
||||
a_1 = temp_a_1
|
||||
return S3(a = a_1)
|
||||
|
||||
def s4(s4_in:S4In):
|
||||
try:
|
||||
def temp_a_6(_:Unit):
|
||||
return (glob5_1 + decimal_of_string("1."))
|
||||
def temp_a_7(_:Unit):
|
||||
return True
|
||||
temp_a_8 = handle_default(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=80, start_column=10,
|
||||
end_line=80, end_column=11,
|
||||
law_headings=["Test inline defs in toplevel defs"]), [],
|
||||
temp_a_7, temp_a_6)
|
||||
temp_a_2 = (glob5_1 + decimal_of_string("1."))
|
||||
except EmptyError:
|
||||
temp_a_8 = dead_value
|
||||
temp_a_2 = dead_value
|
||||
raise NoValueProvided(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=80, start_column=10,
|
||||
end_line=80, end_column=11,
|
||||
law_headings=["Test inline defs in toplevel defs"]))
|
||||
a_2 = temp_a_8
|
||||
a_2 = temp_a_2
|
||||
return S4(a = a_2)
|
||||
|
||||
def s(s_in:SIn):
|
||||
try:
|
||||
def temp_a_9(_:Unit):
|
||||
return (glob1 * glob1)
|
||||
def temp_a_10(_:Unit):
|
||||
return True
|
||||
temp_a_11 = handle_default(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=7, start_column=10,
|
||||
end_line=7, end_column=11,
|
||||
law_headings=["Test basic toplevel values defs"]), [],
|
||||
temp_a_10, temp_a_9)
|
||||
temp_a_3 = (glob1 * glob1)
|
||||
except EmptyError:
|
||||
temp_a_11 = dead_value
|
||||
temp_a_3 = dead_value
|
||||
raise NoValueProvided(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=7, start_column=10,
|
||||
end_line=7, end_column=11,
|
||||
law_headings=["Test basic toplevel values defs"]))
|
||||
a_3 = temp_a_11
|
||||
a_3 = temp_a_3
|
||||
try:
|
||||
def temp_b(_:Unit):
|
||||
return glob2
|
||||
def temp_b_1(_:Unit):
|
||||
return True
|
||||
temp_b_2 = handle_default(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=8, start_column=10,
|
||||
end_line=8, end_column=11,
|
||||
law_headings=["Test basic toplevel values defs"]), [],
|
||||
temp_b_1, temp_b)
|
||||
temp_b = glob2
|
||||
except EmptyError:
|
||||
temp_b_2 = dead_value
|
||||
temp_b = dead_value
|
||||
raise NoValueProvided(SourcePosition(filename="tests/test_name_resolution/good/toplevel_defs.catala_en",
|
||||
start_line=8, start_column=10,
|
||||
end_line=8, end_column=11,
|
||||
law_headings=["Test basic toplevel values defs"]))
|
||||
b = temp_b_2
|
||||
b = temp_b
|
||||
return S(a = a_3, b = b)
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user