Skip to content

Commit 36a1ad4

Browse files
Add for-loop tests & baselines
1 parent ca5f380 commit 36a1ad4

29 files changed

Lines changed: 11813 additions & 0 deletions

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

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,91 @@ 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
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let mutable c = 0uy
2+
3+
module Up =
4+
let constEmpty () =
5+
for n = 10uy to 1uy do
6+
c <- n
7+
8+
let constNonEmpty () =
9+
for n = 1uy to 10uy do
10+
c <- n
11+
12+
let constFinish start =
13+
for n = start to 10uy do
14+
c <- n
15+
16+
let constStart finish =
17+
for n = 1uy to finish do
18+
c <- n
19+
20+
let annotatedStart (start: byte) finish =
21+
for n = start to finish do
22+
c <- n
23+
24+
let annotatedFinish start (finish: byte) =
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

0 commit comments

Comments
 (0)