Skip to content

Commit 09049ed

Browse files
author
Hongbo Zhang
committed
more tests
1 parent d7d3ffe commit 09049ed

File tree

2 files changed

+76
-16
lines changed

2 files changed

+76
-16
lines changed

jscomp/test/caml_format_test.js

+61-15
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ var pairs = Caml_obj.caml_obj_dup(/* array */[
187187
]
188188
]);
189189

190+
var pairs$1 = /* array */[
191+
/* tuple */[
192+
3232,
193+
"32_32.0"
194+
],
195+
/* tuple */[
196+
1.000,
197+
"1.000"
198+
],
199+
/* tuple */[
200+
12.000,
201+
"12.000"
202+
]
203+
];
204+
190205
Mt.from_pair_suites("caml_format_test.ml", Pervasives.$at(from_of_string(of_string), Pervasives.$at(/* :: */[
191206
/* tuple */[
192207
"isnan_of_string",
@@ -231,21 +246,52 @@ Mt.from_pair_suites("caml_format_test.ml", Pervasives.$at(from_of_string(of_stri
231246
};
232247
}
233248
];
234-
}, pairs)), /* :: */[
235-
/* tuple */[
236-
"throw",
237-
function () {
238-
return /* ThrowAny */{
239-
0: function () {
240-
return Caml_format.caml_float_of_string("");
241-
},
242-
length: 1,
243-
tag: 3
244-
};
245-
}
246-
],
247-
/* [] */0
248-
]))));
249+
}, pairs)), Pervasives.$at(/* :: */[
250+
/* tuple */[
251+
"throw",
252+
function () {
253+
return /* ThrowAny */{
254+
0: function () {
255+
return Caml_format.caml_float_of_string("");
256+
},
257+
length: 1,
258+
tag: 3
259+
};
260+
}
261+
],
262+
/* [] */0
263+
], $$Array.to_list($$Array.mapi(function (i, param) {
264+
var b = param[1];
265+
var a = param[0];
266+
return /* tuple */[
267+
Caml_curry.app1(Printf.sprintf(/* Format */{
268+
0: /* String_literal */{
269+
0: "normal_float_of_string ",
270+
1: /* Int */{
271+
0: /* Int_d */0,
272+
1: /* No_padding */0,
273+
2: /* No_precision */0,
274+
3: /* End_of_format */0,
275+
length: 4,
276+
tag: 4
277+
},
278+
length: 2,
279+
tag: 11
280+
},
281+
1: "normal_float_of_string %d",
282+
length: 2,
283+
tag: 0
284+
}), i),
285+
function () {
286+
return /* Eq */{
287+
0: a,
288+
1: Caml_format.caml_float_of_string(b),
289+
length: 2,
290+
tag: 0
291+
};
292+
}
293+
];
294+
}, pairs$1)))))));
249295

250296
exports.of_string = of_string;
251297
exports.from_float_of_string = from_float_of_string;

jscomp/test/caml_format_test.ml

+15-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,19 @@ let v = Printf.sprintf "%3d" 3333
4646
(fun _ -> Mt.Eq(a,
4747
classify_float @@ float_of_string b)))
4848
|> Array.to_list ) @
49-
[ "throw", (fun _ -> Mt.ThrowAny (fun _ -> ignore @@ float_of_string ""))]
49+
[ "throw", (fun _ -> Mt.ThrowAny (fun _ -> ignore @@ float_of_string ""))] @
50+
(let pairs =
51+
[| 3232., "32_32.0";
52+
1.000, "1.000";
53+
12.000, "12.000"
54+
|]
55+
in
56+
pairs
57+
|> Array.mapi
58+
(fun i (a,b) ->
59+
(Printf.sprintf "normal_float_of_string %d" i ),
60+
(fun _ -> Mt.Eq(a,
61+
float_of_string b)))
62+
|> Array.to_list )
63+
5064
)

0 commit comments

Comments
 (0)