Update tests

This commit is contained in:
Louis Gesbert 2023-08-31 17:03:43 +02:00
parent 544e18e110
commit ce97b55c27
7 changed files with 38 additions and 76 deletions

View File

@ -30,17 +30,17 @@ let compute_allocations_familiales
let result =
AF.interface_allocations_familiales
{
AF.InterfaceAllocationsFamilialesIn.i_date_courante_in = current_date;
AF.InterfaceAllocationsFamilialesIn.i_enfants_in = children;
AF.InterfaceAllocationsFamilialesIn.i_ressources_menage_in =
AF.InterfaceAllocationsFamiliales_in.i_date_courante_in = current_date;
AF.InterfaceAllocationsFamiliales_in.i_enfants_in = children;
AF.InterfaceAllocationsFamiliales_in.i_ressources_menage_in =
money_of_units_int income;
AF.InterfaceAllocationsFamilialesIn.i_residence_in = residence;
AF.InterfaceAllocationsFamilialesIn
AF.InterfaceAllocationsFamiliales_in.i_residence_in = residence;
AF.InterfaceAllocationsFamiliales_in
.i_personne_charge_effective_permanente_est_parent_in = is_parent;
AF.InterfaceAllocationsFamilialesIn
AF.InterfaceAllocationsFamiliales_in
.i_personne_charge_effective_permanente_remplit_titre_I_in =
fills_title_I;
AF.InterfaceAllocationsFamilialesIn
AF.InterfaceAllocationsFamiliales_in
.i_avait_enfant_a_charge_avant_1er_janvier_2012_in =
had_rights_open_before_2012;
}

View File

@ -116,7 +116,7 @@ let run_test_allocations_familiales () =
| Runtime.AssertionFailed _ -> ()
let aides_logement_input :
Law_source.Aides_logement.CalculetteAidesAuLogementGardeAlterneeIn.t =
Law_source.Aides_logement.CalculetteAidesAuLogementGardeAlternee_in.t =
{
menage_in =
{
@ -137,7 +137,7 @@ let aides_logement_input :
false;
logement_meuble_d842_2 = false;
changement_logement_d842_4 =
Law_source.Aides_logement.ChangementLogementD8424
Law_source.Aides_logement.ChangementLogementD842_4
.PasDeChangement
();
loyer_principal = Runtime.money_of_units_int 450;

View File

@ -21,57 +21,10 @@ scope T2:
```
```catala-test-inline
$ catala interpret -s T2 --disable_warnings --use mod_def.catala_en --debug
[DEBUG] Loading shared modules...
[DEBUG] Collecting rules...
[DEBUG] Reading files...
[DEBUG] Parsing mod_use.catala_en
[DEBUG] Parsing mod_def.catala_en
[DEBUG] Name resolution...
[DEBUG] Desugaring...
[DEBUG] Disambiguating...
[DEBUG] Linting...
[DEBUG] Typechecking...
[ERROR]
Reference to Mod_def.half not found
┌─⯈ mod_use.catala_en:16.24-16.36:
└──┐
16 │ definition o4 equals Mod_def.half of 10
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test modules + inclusions 2
Raised at Catala_utils__Message.raise_spanned_error.(fun).continuation in file "compiler/catala_utils/message.ml", line 232, characters 4-183
Called from Shared_ast__Typing.typecheck_expr_top_down in file "compiler/shared_ast/typing.ml", line 437, characters 8-97
Called from Shared_ast__Typing.typecheck_expr_top_down in file "compiler/shared_ast/typing.ml", line 810, characters 14-73
Called from Shared_ast__Typing.typecheck_expr_top_down in file "compiler/shared_ast/typing.ml", line 841, characters 16-74
Called from Shared_ast__Typing.wrap_expr.(fun) in file "compiler/shared_ast/typing.ml", line 895, characters 32-37
Called from Shared_ast__Typing.wrap in file "compiler/shared_ast/typing.ml", line 886, characters 6-9
Called from Shared_ast__Typing.expr in file "compiler/shared_ast/typing.ml", line 926, characters 4-48
Called from Scopelang__Ast.type_rule in file "compiler/scopelang/ast.ml", line 62, characters 16-75
Called from Stdlib__List.map in file "list.ml", line 92, characters 20-23
Called from Stdlib__List.map in file "list.ml", line 92, characters 32-39
Called from Scopelang__Ast.type_program.(fun) in file "compiler/scopelang/ast.ml", line 119, characters 13-118
Called from Catala_utils__Mark.map in file "compiler/catala_utils/mark.ml", line 25, characters 19-22
Called from Stdlib__Map.Make.map in file "map.ml", line 304, characters 19-22
Called from Scopelang__Ast.type_program in file "compiler/scopelang/ast.ml", line 111, characters 4-498
Called from Driver.Passes.dcalc in file "compiler/driver.ml", line 114, characters 14-44
Called from Driver.Commands.interpret_dcalc in file "compiler/driver.ml", line 574, characters 6-68
Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44
Called from Cmdliner_eval.eval_value in file "cmdliner_eval.ml", line 202, characters 14-39
Called from Driver.main in file "compiler/driver.ml", line 890, characters 8-49
#return code 123#
```
```catala-test-inline
$ catala ocaml --disable_warnings --use mod_def.catala_en
[ERROR]
Reference to Mod_def.half not found
┌─⯈ mod_use.catala_en:16.24-16.36:
└──┐
16 │ definition o4 equals Mod_def.half of 10
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test modules + inclusions 2
#return code 123#
$ catala interpret -s T2 --disable_warnings --use mod_def.catala_en
[RESULT] Computation successful! Results:
[RESULT] o1 = No ()
[RESULT] o2 = Maybe ()
[RESULT] o3 = $1,000.00
[RESULT] o4 = 5.0
```

View File

@ -37,14 +37,14 @@ module S = struct
type t = {a: bool}
end
module SIn = struct
module S_in = struct
type t = {a_in: unit -> bool}
end
let s (s_in: SIn.t) : S.t =
let a_: unit -> bool = s_in.SIn.a_in in
let s (s_in: S_in.t) : S.t =
let a_: unit -> bool = s_in.S_in.a_in in
let a_: bool =
try
(handle_default

View File

@ -33,24 +33,24 @@ module ScopeB = struct
type t = {a: bool}
end
module ScopeAIn = struct
module ScopeA_in = struct
type t = unit
end
module ScopeBIn = struct
module ScopeB_in = struct
type t = unit
end
let scope_a (scope_a_in: ScopeAIn.t) : ScopeA.t =
let scope_a (scope_a_in: ScopeA_in.t) : ScopeA.t =
let a_: bool = try true with
EmptyError -> (raise (NoValueProvided
{filename = "191_fix_record_name_confusion.catala_en"; start_line=5;
start_column=10; end_line=5; end_column=11; law_headings=["Article"]})) in
{ScopeA.a = a_}
let scope_b (scope_b_in: ScopeBIn.t) : ScopeB.t =
let scope_b (scope_b_in: ScopeB_in.t) : ScopeB.t =
let result_: ScopeA.t = scope_a (()) in
let scope_a_dot_a_: bool = result_.ScopeA.a in
let a_: bool = try scope_a_dot_a_ with

View File

@ -18,13 +18,16 @@ scope RentComputation:
```catala-test-inline
$ catala Interpret -t -s HousingComputation --debug
[DEBUG] Collecting rules...
[DEBUG] Reading files...
[DEBUG] - INIT -
[DEBUG] - SURFACE -
[DEBUG] Parsing scope_call3.catala_en
[DEBUG] - DESUGARED -
[DEBUG] Name resolution...
[DEBUG] Desugaring...
[DEBUG] Disambiguating...
[DEBUG] Linting...
[DEBUG] - SCOPELANG -
[DEBUG] - DCALC -
[DEBUG] Typechecking...
[DEBUG] Translating to default calculus...
[DEBUG] Typechecking again...

View File

@ -24,13 +24,16 @@ scope RentComputation:
```catala-test-inline
$ catala Interpret -s RentComputation --debug
[DEBUG] Collecting rules...
[DEBUG] Reading files...
[DEBUG] - INIT -
[DEBUG] - SURFACE -
[DEBUG] Parsing scope_call4.catala_en
[DEBUG] - DESUGARED -
[DEBUG] Name resolution...
[DEBUG] Desugaring...
[DEBUG] Disambiguating...
[DEBUG] Linting...
[DEBUG] - SCOPELANG -
[DEBUG] - DCALC -
[DEBUG] Typechecking...
[DEBUG] Translating to default calculus...
[DEBUG] Typechecking again...
@ -49,18 +52,21 @@ f2 = λ (x: integer) →
```catala-test-inline
$ catala Interpret_Lcalc -s RentComputation --avoid_exceptions --optimize --debug
[DEBUG] Collecting rules...
[DEBUG] Reading files...
[DEBUG] - INIT -
[DEBUG] - SURFACE -
[DEBUG] Parsing scope_call4.catala_en
[DEBUG] - DESUGARED -
[DEBUG] Name resolution...
[DEBUG] Desugaring...
[DEBUG] Disambiguating...
[DEBUG] Linting...
[DEBUG] - SCOPELANG -
[DEBUG] - DCALC -
[DEBUG] Typechecking...
[DEBUG] Translating to default calculus...
[DEBUG] Optimizing default calculus...
[DEBUG] Typechecking again...
[DEBUG] Compiling program into lambda calculus...
[DEBUG] - LCALC -
[DEBUG] Optimizing lambda calculus...
[DEBUG] Starting interpretation...
[DEBUG] End of interpretation