Skip to content

Commit aa173e2

Browse files
Add for-loop tests & baselines
1 parent 05a8ab4 commit aa173e2

File tree

37 files changed

+19140
-0
lines changed

37 files changed

+19140
-0
lines changed

Diff for: tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs

+84
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,87 @@ module ForLoop =
217217
compilation
218218
|> getCompilation
219219
|> verifyCompilation
220+
221+
// SOURCE=ForLoopSByte.fs SCFLAGS="--optimize+" # ForLoopSByte.fs --optimize+
222+
[<Theory; FileInlineData("ForLoopSByte.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
223+
let ``ForLoopSByte_fs`` compilation =
224+
compilation
225+
|> getCompilation
226+
|> verifyCompilation
227+
228+
// SOURCE=ForLoopByte.fs SCFLAGS="--optimize+" # ForLoopByte.fs --optimize+
229+
[<Theory; FileInlineData("ForLoopByte.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
230+
let ``ForLoopByte_fs`` compilation =
231+
compilation
232+
|> getCompilation
233+
|> verifyCompilation
234+
235+
// SOURCE=ForLoopChar.fs SCFLAGS="--optimize+" # ForLoopChar.fs --optimize+
236+
[<Theory; FileInlineData("ForLoopChar.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
237+
let ``ForLoopChar_fs`` compilation =
238+
compilation
239+
|> getCompilation
240+
|> verifyCompilation
241+
242+
// SOURCE=ForLoopInt16.fs SCFLAGS="--optimize+" # ForLoopInt16.fs --optimize+
243+
[<Theory; FileInlineData("ForLoopInt16.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
244+
let ``ForLoopInt16_fs`` compilation =
245+
compilation
246+
|> getCompilation
247+
|> verifyCompilation
248+
249+
// SOURCE=ForLoopUInt16.fs SCFLAGS="--optimize+" # ForLoopUInt16.fs --optimize+
250+
[<Theory; FileInlineData("ForLoopUInt16.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
251+
let ``ForLoopUInt16_`` compilation =
252+
compilation
253+
|> getCompilation
254+
|> verifyCompilation
255+
256+
// SOURCE=ForLoopInt32.fs SCFLAGS="--optimize+" # ForLoopInt32.fs --optimize+
257+
[<Theory; FileInlineData("ForLoopInt32.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
258+
let ``ForLoopInt32_fs`` compilation =
259+
compilation
260+
|> getCompilation
261+
|> verifyCompilation
262+
263+
// SOURCE=ForLoopUInt32.fs SCFLAGS="--optimize+" # ForLoopUInt32.fs --optimize+
264+
[<Theory; FileInlineData("ForLoopUInt32.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
265+
let ``ForLoopUInt32_fs`` compilation =
266+
compilation
267+
|> getCompilation
268+
|> verifyCompilation
269+
270+
// SOURCE=ForLoopInt64.fs SCFLAGS="--optimize+" # ForLoopInt64.fs --optimize+
271+
[<Theory; FileInlineData("ForLoopInt64.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
272+
let ``ForLoopInt64_fs`` compilation =
273+
compilation
274+
|> getCompilation
275+
|> verifyCompilation
276+
277+
// SOURCE=ForLoopUInt64.fs SCFLAGS="--optimize+" # ForLoopUInt64.fs --optimize+
278+
[<Theory; FileInlineData("ForLoopUInt64.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
279+
let ``ForLoopUInt64_fs`` compilation =
280+
compilation
281+
|> getCompilation
282+
|> verifyCompilation
283+
284+
// SOURCE=ForLoopIntPtr.fs SCFLAGS="--optimize+" # ForLoopIntPtr.fs --optimize+
285+
[<Theory; FileInlineData("ForLoopIntPtr.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
286+
let ``ForLoopIntPtr_fs`` compilation =
287+
compilation
288+
|> getCompilation
289+
|> verifyCompilation
290+
291+
// SOURCE=ForLoopUIntPtr.fs SCFLAGS="--optimize+" # ForLoopUIntPtr.fs --optimize+
292+
[<Theory; FileInlineData("ForLoopUIntPtr.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
293+
let ``ForLoopUIntPtr_fs`` compilation =
294+
compilation
295+
|> getCompilation
296+
|> verifyCompilation
297+
298+
// SOURCE=ForLoopBigInt.fs SCFLAGS="--optimize+" # ForLoopBigInt.fs --optimize+
299+
[<Theory; FileInlineData("ForLoopBigInt.fs", Realsig=BooleanOptions.Both, Optimize=BooleanOptions.True)>]
300+
let ``ForLoopBigInt_fs`` compilation =
301+
compilation
302+
|> getCompilation
303+
|> verifyCompilation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
let mutable c = 0I
2+
3+
module Up =
4+
let constEmpty () =
5+
for n = 10I to 1I do
6+
c <- n
7+
8+
let constNonEmpty () =
9+
for n = 1I to 10I do
10+
c <- n
11+
12+
let constFinish start =
13+
for n = start to 10I do
14+
c <- n
15+
16+
let constStart finish =
17+
for n = 1I to finish do
18+
c <- n
19+
20+
let annotatedStart (start: bigint) finish =
21+
for n = start to finish do
22+
c <- n
23+
24+
let annotatedFinish start (finish: bigint) =
25+
for n = start to finish do
26+
c <- n
27+
28+
let inferredStartAndFinish start finish =
29+
for n = start to finish do
30+
c <- n
31+
32+
module Down =
33+
let constEmpty () =
34+
for n = 1I downto 10I do
35+
c <- n
36+
37+
let constNonEmpty () =
38+
for n = 10I downto 1I do
39+
c <- n
40+
41+
let constFinish start =
42+
for n = start downto 1I do
43+
c <- n
44+
45+
let constStart finish =
46+
for n = 10I downto finish do
47+
c <- n
48+
49+
let annotatedStart (start: bigint) finish =
50+
for n = start downto finish do
51+
c <- n
52+
53+
let annotatedFinish start (finish: bigint) =
54+
for n = start downto finish do
55+
c <- n
56+
57+
let inferredStartAndFinish start finish =
58+
for n = start downto finish do
59+
c <- n

0 commit comments

Comments
 (0)