Skip to content

Commit

Permalink
raise an exception in unsupported cases
Browse files Browse the repository at this point in the history
  • Loading branch information
rprimet committed Nov 25, 2024
1 parent 05cdd36 commit a0ea8eb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test-case-parser/test_case_parser_lib_atd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ let get_lang_strings = function
content = "contenu";
scope = "champ d'application";
}
| En | Pl -> {
| En -> {
declaration_scope = "declaration scope";
output_scope = "output";
using_module = "Using";
Expand All @@ -371,25 +371,33 @@ let get_lang_strings = function
content = "content";
scope = "scope";
}
| Pl -> Message.error
"Polish language support is not implemented for test case generation"

let rec print_catala_value ~lang ppf =
let open Format in
function
| O.Bool b ->
(match lang with
| Catala_utils.Global.Fr -> pp_print_string ppf (if b then "vrai" else "faux")
| En | Pl -> pp_print_bool ppf b)
| En -> pp_print_bool ppf b
| Pl -> Message.error
"Polish language support is not implemented for test case generation")
| O.Money m ->
(match lang with
| Catala_utils.Global.Fr -> fprintf ppf "%01d,%02d €" (m/100) (m mod 100)
| En | Pl -> fprintf ppf "$%01d.%02d" (m/100) (m mod 100))
| En -> fprintf ppf "$%01d.%02d" (m/100) (m mod 100)
| Pl -> Message.error
"Polish language support is not implemented for test case generation")
| O.Integer i -> pp_print_int ppf i
| O.Decimal f ->
(match lang with
| Catala_utils.Global.Fr ->
let s = sprintf "%g" f in
pp_print_string ppf (String.map (function '.' -> ',' | c -> c) s)
| En | Pl -> pp_print_float ppf f)
| En -> pp_print_float ppf f
| Pl -> Message.error
"Polish language support is not implemented for test case generation")
| O.Date { year; month; day } ->
fprintf ppf "|%04d-%02d-%02d|" year month day
| O.Duration { years = 0; months = 0; days = 0 } ->
Expand Down

0 comments on commit a0ea8eb

Please sign in to comment.