Update tests and create disable_warnings option

This commit is contained in:
Denis Merigoux 2023-03-31 16:43:03 +02:00
parent 3d86a12261
commit 6d71d52a2e
No known key found for this signature in database
GPG Key ID: EE99DCFA365C3EE3
14 changed files with 255 additions and 48 deletions

View File

@ -86,6 +86,7 @@ let style_flag = ref true
(* Max number of digits to show for decimal results *)
let max_prec_digits = ref 20
let trace_flag = ref false
let disable_warnings_flag = ref false
let optimize_flag = ref false
let disable_counterexamples = ref false
let avoid_exceptions_flag = ref false
@ -135,19 +136,26 @@ let trace_opt =
"Displays a trace of the interpreter's computation or generates \
logging instructions in translate programs.")
let disable_warnings_opt =
Arg.(
value
& flag
& info ["disable_warnings"]
~doc:"Disable all the warnings emitted by the compiler.")
let avoid_exceptions =
Arg.(
value
& flag
& info ["avoid_exceptions"]
~doc:"Compiles the default calculus without exceptions")
~doc:"Compiles the default calculus without exceptions.")
let closure_conversion =
Arg.(
value
& flag
& info ["closure_conversion"]
~doc:"Performs closure conversion on the lambda calculus")
~doc:"Performs closure conversion on the lambda calculus.")
let wrap_weaved_output =
Arg.(
@ -243,6 +251,7 @@ type options = {
language : string option;
max_prec_digits : int option;
trace : bool;
disable_warnings : bool;
disable_counterexamples : bool;
optimize : bool;
ex_scope : string option;
@ -263,6 +272,7 @@ let options =
plugins_dirs
language
max_prec_digits
disable_warnings
trace
disable_counterexamples
optimize
@ -278,6 +288,7 @@ let options =
plugins_dirs;
language;
max_prec_digits;
disable_warnings;
trace;
disable_counterexamples;
optimize;
@ -299,6 +310,7 @@ let options =
$ plugins_dirs
$ language
$ max_prec_digits_opt
$ disable_warnings_opt
$ trace_opt
$ disable_counterexamples_opt
$ optimize
@ -315,6 +327,10 @@ let set_option_globals options : unit =
| Always -> true
| Never -> false
| Auto -> Unix.isatty Unix.stdout);
(match options.max_prec_digits with
| None -> ()
| Some i -> max_prec_digits := i);
disable_warnings_flag := options.disable_warnings;
trace_flag := options.trace;
optimize_flag := options.optimize;
disable_counterexamples := options.disable_counterexamples;
@ -495,7 +511,8 @@ let error_print (format : ('a, out_channel, unit) format) =
Printf.eprintf ("%s" ^^ format ^^ "\n%!") (error_marker ())
let warning_print (format : ('a, out_channel, unit) format) =
Printf.printf ("%s" ^^ format ^^ "\n%!") (warning_marker ())
if !disable_warnings_flag then Printf.ifprintf stdout format
else Printf.printf ("%s" ^^ format ^^ "\n%!") (warning_marker ())
let result_print (format : ('a, out_channel, unit) format) =
Printf.printf ("%s" ^^ format ^^ "\n%!") (result_marker ())

View File

@ -64,6 +64,7 @@ val max_prec_digits : int ref
(** Max number of digits to show for decimal results *)
val trace_flag : bool ref
val disable_warnings_flag : bool ref
val disable_counterexamples : bool ref
(** Disables model-generated counterexamples for proofs that fail. *)
@ -99,6 +100,7 @@ type options = {
language : string option;
max_prec_digits : int option;
trace : bool;
disable_warnings : bool;
disable_counterexamples : bool;
optimize : bool;
ex_scope : string option;

View File

@ -39,9 +39,6 @@ let driver source_file (options : Cli.options) : int =
(match source_file with
| Pos.FileName f -> filename := f
| Contents c -> Cli.contents := c);
(match options.max_prec_digits with
| None -> ()
| Some i -> Cli.max_prec_digits := i);
let l =
match options.language with
| Some l -> l

View File

@ -65,13 +65,13 @@ champ d'application Exemple2 :
```catala-test-inline
$ catala Interpret -s Exemple1
$ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 345.73 €
```
```catala-test-inline
$ catala Interpret -s Exemple2
$ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 352.77 €
```

View File

@ -30,7 +30,7 @@ champ d'application CasTest1:
```
```catala-test-inline
$ catala Interpret -s CasTest1
$ catala Interpret -s CasTest1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 76.38 €
```

View File

@ -144,26 +144,26 @@ champ d'application Exemple4:
```
```catala-test-inline
$ catala Interpret -s Exemple1
$ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 181.91 €
```
```catala-test-inline
$ catala Interpret -s Exemple2
$ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 67.34 €
```
```catala-test-inline
$ catala Interpret -s Exemple3
$ catala Interpret -s Exemple3 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 181.91 €
```
```catala-test-inline
$ catala Interpret -s Exemple4
$ catala Interpret -s Exemple4 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 118.59 €
```

View File

@ -270,55 +270,55 @@ champ d'application Exemple9:
```
```catala-test-inline
$ catala Interpret -s Exemple1
$ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 0.00 €
```
```catala-test-inline
$ catala Interpret -s Exemple2
$ catala Interpret -s Exemple2 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 352.77 €
```
```catala-test-inline
$ catala Interpret -s Exemple3
$ catala Interpret -s Exemple3 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 321.61 €
```
```catala-test-inline
$ catala Interpret -s Exemple4
$ catala Interpret -s Exemple4 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 0.00 €
```
```catala-test-inline
$ catala Interpret -s Exemple5
$ catala Interpret -s Exemple5 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 311.56 €
```
```catala-test-inline
$ catala Interpret -s Exemple6
$ catala Interpret -s Exemple6 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 0.00 €
```
```catala-test-inline
$ catala Interpret -s Exemple7
$ catala Interpret -s Exemple7 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 153.77 €
```
```catala-test-inline
$ catala Interpret -s Exemple8
$ catala Interpret -s Exemple8 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 11.06 €
```
```catala-test-inline
$ catala Interpret -s Exemple9
$ catala Interpret -s Exemple9 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 210.06 €
```

View File

@ -127,31 +127,31 @@ champ d'application CasTest5:
```
```catala-test-inline
$ catala Interpret -s CasTest1
$ catala Interpret -s CasTest1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 12.06 €
```
```catala-test-inline
$ catala Interpret -s CasTest2
$ catala Interpret -s CasTest2 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 23.12 €
```
```catala-test-inline
$ catala Interpret -s CasTest3
$ catala Interpret -s CasTest3 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 154.78 €
```
```catala-test-inline
$ catala Interpret -s CasTest4
$ catala Interpret -s CasTest4 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 154.78 €
```
```catala-test-inline
$ catala Interpret -s CasTest5
$ catala Interpret -s CasTest5 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] montant = 129.65 €
```

View File

@ -242,12 +242,142 @@ champ d'application Exemple2 :
```
```catala-test-inline
$ catala Interpret -s Exemple1
$ catala Interpret -s Exemple1 --disable_warnings
[RESULT] Computation successful! Results:
[RESULT] éligible = true
```
```catala-test-inline
$ catala Typecheck
[WARNING] The variable "ressources_ménage_arrondies.seuil" is declared but never defined in scope "RessourcesAidesPersonnelleLogement"; did you forget something?
┌─⯈ examples/aides_logement/tests/../prologue.catala_fr:496.9-14:
└───┐
496 │ état seuil
│ ‾‾‾‾‾
└┬ Prologue : aides au logement
└┬ Déclarations des champs d'application
└─ Prise en compte des ressources pour les aides personnelles au logement
[WARNING] The variable "ressources_forfaitaires_r822_20" is declared but never defined in scope "RessourcesAidesPersonnelleLogement"; did you forget something?
┌─⯈ examples/aides_logement/tests/../prologue.catala_fr:504.10-41:
└───┐
504 │ interne ressources_forfaitaires_r822_20 contenu argent
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue : aides au logement
└┬ Déclarations des champs d'application
└─ Prise en compte des ressources pour les aides personnelles au logement
[WARNING] The constructor "AllocationJeuneEnfant" of enumeration "PrestationReçue" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../prologue.catala_fr:132.5-26:
└───┐
132 │ -- AllocationJeuneEnfant
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue : aides au logement
└┬ Types de données manipulées par le programme
└┬ Calcul et éligibilité des aides personnelles au logement
└─ Calcul et éligibilité pour tous les secteurs
[WARNING] The constructor "Descendant" of enumeration "Parenté" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../prologue.catala_fr:185.5-15:
└───┐
185 │ -- Descendant
│ ‾‾‾‾‾‾‾‾‾‾
└┬ Prologue : aides au logement
└┬ Types de données manipulées par le programme
└┬ Calcul et éligibilité des aides personnelles au logement
└─ Calcul et éligibilité pour tous les secteurs
[WARNING] The constructor "CollatéralDeuxièmeTroisièmeDegré" of enumeration "Parenté" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../prologue.catala_fr:186.5-37:
└───┐
186 │ -- CollatéralDeuxièmeTroisièmeDegré
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue : aides au logement
└┬ Types de données manipulées par le programme
└┬ Calcul et éligibilité des aides personnelles au logement
└─ Calcul et éligibilité pour tous les secteurs
[WARNING] The enumeration "PriseEnCharge" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../code_construction_legislatif.catala_fr:444.24-37:
└───┐
444 │ déclaration énumération PriseEnCharge:
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Code de la construction et de l'habitation
└┬ Partie législative
└┬ Livre VIII : Aides personnelles au logement
└┬ Titre II : Dispositions communes aux aides personnelles au logement
└┬ Chapitre III : Modalités de liquidation et de versement
└─ Article L823-2
[WARNING] The constructor "GardeAlternéeAllocataireUnique" of enumeration "PriseEnChargeEnfant" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:10.5-35:
└──┐
10 │ -- GardeAlternéeAllocataireUnique
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "ServicesSociauxAllocationVerséeÀLaFamille" of enumeration "PriseEnChargeEnfant" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:12.5-46:
└──┐
12 │ -- ServicesSociauxAllocationVerséeÀLaFamille
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "ServicesSociauxAllocationVerséeAuxServicesSociaux" of enumeration "PriseEnChargeEnfant" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:13.5-54:
└──┐
13 │ -- ServicesSociauxAllocationVerséeAuxServicesSociaux
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "PrestationAccueilJeuneEnfant" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:30.5-33:
└──┐
30 │ -- PrestationAccueilJeuneEnfant
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "ComplémentFamilial" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:32.5-23:
└──┐
32 │ -- ComplémentFamilial
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "AllocationLogement" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:33.5-23:
└──┐
33 │ -- AllocationLogement
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "AllocationÉducationEnfantHandicapé" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:34.5-39:
└──┐
34 │ -- AllocationÉducationEnfantHandicapé
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "AllocationSoutienFamilial" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:35.5-30:
└──┐
35 │ -- AllocationSoutienFamilial
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "AllocationRentréeScolaire" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:36.5-30:
└──┐
36 │ -- AllocationRentréeScolaire
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[WARNING] The constructor "AllocationJournalièrePresenceParentale" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/aides_logement/tests/../../prestations_familiales/prologue.catala_fr:37.5-43:
└──┐
37 │ -- AllocationJournalièrePresenceParentale
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Prologue : prestations familiales
[RESULT] Typechecking successful!
```

View File

@ -349,71 +349,132 @@ champ d'application Test14:
```
```catala-test-inline
$ catala Interpret -s Test1
$ catala Typecheck
[WARNING] The constructor "PrestationAccueilJeuneEnfant" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:41.5-33:
└──┐
41 │ -- PrestationAccueilJeuneEnfant
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "ComplémentFamilial" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:43.5-23:
└──┐
43 │ -- ComplémentFamilial
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "AllocationLogement" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:44.5-23:
└──┐
44 │ -- AllocationLogement
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "AllocationÉducationEnfantHandicapé" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:45.5-39:
└──┐
45 │ -- AllocationÉducationEnfantHandicapé
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "AllocationSoutienFamilial" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:46.5-30:
└──┐
46 │ -- AllocationSoutienFamilial
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "AllocationRentréeScolaire" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:47.5-30:
└──┐
47 │ -- AllocationRentréeScolaire
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[WARNING] The constructor "AllocationJournalièrePresenceParentale" of enumeration "ÉlémentPrestationsFamiliales" is never used; maybe it's unnecessary?
┌─⯈ examples/allocations_familiales/tests/../prologue.catala_fr:48.5-43:
└──┐
48 │ -- AllocationJournalièrePresenceParentale
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Prologue
└─ Types de données manipulées par le programme
[RESULT] Typechecking successful!
```
```catala-test-inline
$ catala Interpret -s Test1 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test2
$ catala Interpret -s Test2 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test3
$ catala Interpret -s Test3 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test4
$ catala Interpret -s Test4 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test5
$ catala Interpret -s Test5 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test6
$ catala Interpret -s Test6 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test7
$ catala Interpret -s Test7 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test8
$ catala Interpret -s Test8 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test9
$ catala Interpret -s Test9 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test10
$ catala Interpret -s Test10 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test11
$ catala Interpret -s Test11 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test12
$ catala Interpret -s Test12 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test13
$ catala Interpret -s Test13 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s Test13
$ catala Interpret -s Test13 --disable_warnings
[RESULT] Computation successful!
```

View File

@ -62,6 +62,6 @@ champ d'application Test1:
```
```catala-test-inline
$ catala Interpret -s Test1
$ catala Interpret -s Test1 --disable_warnings
[RESULT] Computation successful!
```

View File

@ -62,6 +62,6 @@ champ d'application Test1:
```
```catala-test-inline
$ catala Interpret -s Test1
$ catala Interpret -s Test1 --disable_warnings
[RESULT] Computation successful!
```

View File

@ -29,11 +29,11 @@ scope UnitTest2:
```
```catala-test-inline
$ catala Interpret -s UnitTest1
$ catala Interpret -s UnitTest1 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s UnitTest2
$ catala Interpret -s UnitTest2 --disable_warnings
[RESULT] Computation successful!
```

View File

@ -29,11 +29,11 @@ champ d'application TestUnitaire2:
```
```catala-test-inline
$ catala Interpret -s TestUnitaire1
$ catala Interpret -s TestUnitaire1 --disable_warnings
[RESULT] Computation successful!
```
```catala-test-inline
$ catala Interpret -s TestUnitaire2
$ catala Interpret -s TestUnitaire2 --disable_warnings
[RESULT] Computation successful!
```