Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / benchmark / tests / string-concat.sml
CommitLineData
7f918cf1
CE
1structure Main =
2 struct
3 val alpha = CharVector.tabulate (26, fn i => chr (ord #"A" + i))
4 fun doit n =
5 let
6 val len = 2017
7 val s = CharVector.tabulate (len, fn i =>
8 String.sub (alpha, i mod 26))
9 fun loop n =
10 if n < 0
11 then ()
12 else
13 if 468705 = CharVector.foldl (fn (c, s) => s + ord c) 0 (String.concat [s, s, s])
14 then loop (n - 1)
15 else raise Fail "bug"
16 in loop (n * 10000)
17 end
18 end