Skip to content

Commit f562133

Browse files
Add for-loop tests & baselines
1 parent 751bc50 commit f562133

25 files changed

+9867
-0
lines changed

tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForLoop.fs

+96
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,99 @@ 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.True, Optimize=BooleanOptions.True)>]
223+
let ``ForLoopSByte_fs`` compilation =
224+
compilation
225+
|> getCompilation
226+
|> withLangVersionPreview
227+
|> verifyCompilation
228+
229+
// SOURCE=ForLoopByte.fs SCFLAGS="--optimize+" # ForLoopByte.fs --optimize+
230+
[<Theory; FileInlineData("ForLoopByte.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
231+
let ``ForLoopByte_fs`` compilation =
232+
compilation
233+
|> getCompilation
234+
|> withLangVersionPreview
235+
|> verifyCompilation
236+
237+
// SOURCE=ForLoopChar.fs SCFLAGS="--optimize+" # ForLoopChar.fs --optimize+
238+
[<Theory; FileInlineData("ForLoopChar.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
239+
let ``ForLoopChar_fs`` compilation =
240+
compilation
241+
|> getCompilation
242+
|> withLangVersionPreview
243+
|> verifyCompilation
244+
245+
// SOURCE=ForLoopInt16.fs SCFLAGS="--optimize+" # ForLoopInt16.fs --optimize+
246+
[<Theory; FileInlineData("ForLoopInt16.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
247+
let ``ForLoopInt16_fs`` compilation =
248+
compilation
249+
|> getCompilation
250+
|> withLangVersionPreview
251+
|> verifyCompilation
252+
253+
// SOURCE=ForLoopUInt16.fs SCFLAGS="--optimize+" # ForLoopUInt16.fs --optimize+
254+
[<Theory; FileInlineData("ForLoopUInt16.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
255+
let ``ForLoopUInt16_`` compilation =
256+
compilation
257+
|> getCompilation
258+
|> withLangVersionPreview
259+
|> verifyCompilation
260+
261+
// SOURCE=ForLoopInt32.fs SCFLAGS="--optimize+" # ForLoopInt32.fs --optimize+
262+
[<Theory; FileInlineData("ForLoopInt32.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
263+
let ``ForLoopInt32_fs`` compilation =
264+
compilation
265+
|> getCompilation
266+
|> withLangVersionPreview
267+
|> verifyCompilation
268+
269+
// SOURCE=ForLoopUInt32.fs SCFLAGS="--optimize+" # ForLoopUInt32.fs --optimize+
270+
[<Theory; FileInlineData("ForLoopUInt32.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
271+
let ``ForLoopUInt32_fs`` compilation =
272+
compilation
273+
|> getCompilation
274+
|> withLangVersionPreview
275+
|> verifyCompilation
276+
277+
// SOURCE=ForLoopInt64.fs SCFLAGS="--optimize+" # ForLoopInt64.fs --optimize+
278+
[<Theory; FileInlineData("ForLoopInt64.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
279+
let ``ForLoopInt64_fs`` compilation =
280+
compilation
281+
|> getCompilation
282+
|> withLangVersionPreview
283+
|> verifyCompilation
284+
285+
// SOURCE=ForLoopUInt64.fs SCFLAGS="--optimize+" # ForLoopUInt64.fs --optimize+
286+
[<Theory; FileInlineData("ForLoopUInt64.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
287+
let ``ForLoopUInt64_fs`` compilation =
288+
compilation
289+
|> getCompilation
290+
|> withLangVersionPreview
291+
|> verifyCompilation
292+
293+
// SOURCE=ForLoopIntPtr.fs SCFLAGS="--optimize+" # ForLoopIntPtr.fs --optimize+
294+
[<Theory; FileInlineData("ForLoopIntPtr.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
295+
let ``ForLoopIntPtr_fs`` compilation =
296+
compilation
297+
|> getCompilation
298+
|> withLangVersionPreview
299+
|> verifyCompilation
300+
301+
// SOURCE=ForLoopUIntPtr.fs SCFLAGS="--optimize+" # ForLoopUIntPtr.fs --optimize+
302+
[<Theory; FileInlineData("ForLoopUIntPtr.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
303+
let ``ForLoopUIntPtr_fs`` compilation =
304+
compilation
305+
|> getCompilation
306+
|> withLangVersionPreview
307+
|> verifyCompilation
308+
309+
// SOURCE=ForLoopBigInt.fs SCFLAGS="--optimize+" # ForLoopBigInt.fs --optimize+
310+
[<Theory; FileInlineData("ForLoopBigInt.fs", Realsig=BooleanOptions.True, Optimize=BooleanOptions.True)>]
311+
let ``ForLoopBigInt_fs`` compilation =
312+
compilation
313+
|> getCompilation
314+
|> withLangVersionPreview
315+
|> 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)