1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
open StdLabels
module T = Translator
let error = ref 0
let process (optional_line : string option) expected =
match optional_line with
| None -> ()
| Some line ->
match T.Reader.process line with
| Error result ->
error := 1;
Printf.fprintf stdout
"%s : %s\n%!"
line
result
| Ok response ->
if String.equal response expected then
()
(*
(Printf.fprintf stdout "%s : %s OK \n%!"
line
expected)
*)
else (
error := 1;
(Printf.fprintf stdout "%s : got %s / %s expected\n%!"
line
response
expected)
)
let rec repeat input expected =
(* Attempt to read one line. *)
let optional_line, continue = T.Lexer.line input in
process optional_line expected;
if continue then
repeat input expected
let tests =
[ "abaca", "abaka"
; "abaissa", "abEsa"
; "abaissait", "abEsE(t)"
; "abaissant", "abEs@(t)"
; "abaissées", "abEse(s)"
; "abaissera", "abEs°Ra"
; "achat", "aSa(t)"
; "as", "a(s)"
; "astiqué", "astike"
; "casait", "kazE(t)"
; "cassait", "kasE(t)"
; "chanci", "S@si"
; "chat", "Sa(t)"
; "chipant", "Sip@(t)"
; "pacha", "paSa"
; "péché", "peSe"
; "persai", "pERse"
; "asia", "azia"
; "ani", "ani"
; "anta", "@ta"
; "plat", "pLa(t)"
]
let () =
let () = List.iter tests
~f:(fun (input, expected) ->
repeat (Lexing.from_string input) expected)
in
exit !error
|