-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler] More tests for "for" loops (#11584)
* add some tests for for loops * fix missing output case * get rid of tabs, commented tests, remove infinite_lop_with_dead_exits from -v2/tests since output is incorrect * add tests illustrating issue #11427
- Loading branch information
1 parent
b630041
commit 8f0c41a
Showing
65 changed files
with
703 additions
and
34 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
third_party/move/move-compiler-v2/tests/checking/control_flow/for_loop_empty_novar.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
Diagnostics: | ||
error: undeclared `<SELF>_0::_` | ||
┌─ tests/checking/control_flow/for_loop_empty_novar.move:4:9 | ||
│ | ||
4 │ for (_ in 0..10) {}; | ||
│ ^^^^^^^^^^^^^^^^^^^ |
6 changes: 6 additions & 0 deletions
6
third_party/move/move-compiler-v2/tests/checking/control_flow/for_loop_empty_novar.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
for (_ in 0..10) {}; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
third_party/move/move-compiler-v2/tests/checking/control_flow/for_type_mismatch.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Diagnostics: | ||
error: invalid call of `+`: expected `integer` but found `bool` for argument 1 | ||
┌─ tests/checking/control_flow/for_type_mismatch.move:5:9 | ||
│ | ||
5 │ ╭ for (i in true..false) { | ||
6 │ │ x = x + 1; | ||
7 │ │ }; | ||
│ ╰─────────^ | ||
|
||
error: invalid call of `<`: expected `integer` but found `bool` for argument 1 | ||
┌─ tests/checking/control_flow/for_type_mismatch.move:5:9 | ||
│ | ||
5 │ ╭ for (i in true..false) { | ||
6 │ │ x = x + 1; | ||
7 │ │ }; | ||
│ ╰─────────^ |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// ---- Model Dump | ||
module <SELF>_0 { | ||
private fun main() { | ||
loop { | ||
break | ||
}; | ||
loop { | ||
Tuple() | ||
} | ||
} | ||
spec fun $main(); | ||
} // end <SELF>_0 |
6 changes: 6 additions & 0 deletions
6
third_party/move/move-compiler-v2/tests/checking/control_flow/loop_after_loop.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
script { | ||
fun main() { | ||
loop { break }; | ||
loop () | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../move/move-compiler-v2/transactional-tests/tests/control_flow/break_continue_for_loop.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
14 changes: 14 additions & 0 deletions
14
...move/move-compiler-v2/transactional-tests/tests/control_flow/break_continue_for_loop.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//# run | ||
script { | ||
fun main() { | ||
let x = 0; | ||
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | ||
x = x + 1; // 1, 4, 13, 16, | ||
if (x >= 15) break; | ||
x = x + 2; // 3, 6, 15, - | ||
if (i % 2 == 0) continue; | ||
x = x * 2; // -, 12, -, - | ||
}; | ||
assert!(x == 16, x); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ove-compiler-v2/transactional-tests/tests/control_flow/break_continue_for_loop_nested.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
28 changes: 28 additions & 0 deletions
28
...ve-compiler-v2/transactional-tests/tests/control_flow/break_continue_for_loop_nested.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//# run | ||
script { | ||
fun main() { | ||
let k = 0; | ||
let y = 0; | ||
for (j in 0..10) { //j: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | ||
y = y + 1; //y: 1, 4, 13, 16, | ||
if (y >= 15) break; | ||
y = y + 2; //y: 3, 6, 15, - | ||
let x = 0; | ||
for (i in 0..10) { //i: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | ||
x = x + 1; //x: 1, 4, 13, 16, | ||
if (x >= 15) break; | ||
x = x + 2; //x: 3, 6, 15, - | ||
if (i % 2 == 0) continue; | ||
x = x * 2; //x: -, 12, -, - | ||
}; | ||
assert!(x == 16, x); | ||
k = k + x; //k: 16, 32, 48, - | ||
if (j % 2 == 0) continue; | ||
y = y * 2; //y: -, 12, -, - | ||
}; | ||
// k: 48, y: 16 | ||
let z = 3 * k + y; | ||
// z: 208 | ||
assert!(z == 160, z); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_empty.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
10 changes: 10 additions & 0 deletions
10
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_empty.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//# run | ||
script { | ||
fun main() { | ||
let x = 0; | ||
for (i in 10..4) { | ||
x = x + 1; | ||
}; | ||
assert!(x == 0, 42); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...d_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_counter.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
10 changes: 10 additions & 0 deletions
10
..._party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_counter.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
let y = 0; | ||
for (i in 0..1 spec {invariant y > 0;}) { | ||
y = y + 1; | ||
}; | ||
assert!(y == 1, 20); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_empty.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
6 changes: 6 additions & 0 deletions
6
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_empty.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
for (i in 0..10) {}; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...rty/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_empty_range.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
8 changes: 8 additions & 0 deletions
8
...ty/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_empty_range.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
for (i in 10..9) { | ||
assert!(false, 42); | ||
}; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
.../move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_increment_iter.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
11 changes: 11 additions & 0 deletions
11
...move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_increment_iter.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
let y = 0; | ||
for (i in 0..10) { | ||
y = y + 1; | ||
i = i + 1; | ||
}; | ||
assert!(y == 5, 42); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ty/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_nested_break.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
processed 1 task | ||
|
||
task 0 'run'. lines 1-14: | ||
Error: Script execution failed with VMError: { | ||
major_status: OUT_OF_GAS, | ||
sub_status: None, | ||
location: script, | ||
indices: redacted, | ||
offsets: redacted, | ||
} | ||
|
||
==> Compiler v2 delivered same results! |
14 changes: 14 additions & 0 deletions
14
...y/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_nested_break.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//# run --gas-budget 700 | ||
script { | ||
fun main() { | ||
// nonterminating loop | ||
for (i in 0..10) { | ||
i = 0; | ||
for (j in 0..10) { | ||
break; | ||
}; | ||
}; | ||
if (true) () else (); | ||
assert!(false, 42); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_non_terminating.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
processed 1 task | ||
|
||
task 0 'run'. lines 1-11: | ||
Error: Script execution failed with VMError: { | ||
major_status: OUT_OF_GAS, | ||
sub_status: None, | ||
location: script, | ||
indices: redacted, | ||
offsets: redacted, | ||
} | ||
|
||
==> Compiler v2 delivered same results! |
11 changes: 11 additions & 0 deletions
11
...ove/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_non_terminating.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//# run --gas-budget 700 | ||
script { | ||
fun main(): () { | ||
let y = 0; | ||
// out of gas | ||
for (i in 0..10) { | ||
i = 0; | ||
}; | ||
assert!(false, 42); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...rty/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_upper_bound.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
processed 2 tasks | ||
|
||
task 1 'run'. lines 16-16: | ||
return values: 1 | ||
|
||
==> Compiler v2 delivered same results! |
16 changes: 16 additions & 0 deletions
16
...ty/move/move-compiler-v2/transactional-tests/tests/control_flow/for_loop_upper_bound.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//# publish | ||
module 0x42::m { | ||
|
||
fun foo(x: &mut u64): u64 { | ||
*x = *x + 1; | ||
10 | ||
} | ||
|
||
fun main(): u64 { | ||
let x = 0; | ||
for (i in 0..foo(&mut x)) {}; | ||
x | ||
} | ||
} | ||
|
||
//# run 0x42::m::main |
6 changes: 6 additions & 0 deletions
6
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_test_v.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
processed 2 tasks | ||
|
||
task 1 'run'. lines 16-16: | ||
return values: 1 | ||
|
||
==> Compiler v2 delivered same results! |
16 changes: 16 additions & 0 deletions
16
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_test_v.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//# publish | ||
module 0x42::m { | ||
|
||
fun foo(x: &mut u64): u64 { | ||
*x = *x + 1; | ||
10 | ||
} | ||
|
||
fun main(): u64 { | ||
let x = 0; | ||
for (i in 0..foo(&mut x)) {}; | ||
x | ||
} | ||
} | ||
|
||
//# run 0x42::m::main |
39 changes: 39 additions & 0 deletions
39
..._party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_type_mismatch.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
comparison between v1 and v2 failed: | ||
= processed 1 task | ||
= | ||
= task 0 'run'. lines 1-10: | ||
- Error: error[E04007]: incompatible types | ||
+ Error: compilation errors: | ||
+ error: invalid call of `+`: expected `integer` but found `bool` for argument 1 | ||
= ┌─ TEMPFILE:5:9 | ||
- │ | ||
- 5 │ ╭ ╭ for (i in true..false) { | ||
- │ ---- Found: 'bool'. It is not compatible with the other type. | ||
- 6 │ │ │ x = x + 1; | ||
- 7 │ │ │ }; | ||
- │ ╰─│─────────^ Incompatible arguments to '+' | ||
- │ ╰─────────' Found: integer. It is not compatible with the other type. | ||
- | ||
- error[E04003]: built-in operation not supported | ||
- ┌─ TEMPFILE:5:9 | ||
= │ | ||
= 5 │ ╭ for (i in true..false) { | ||
- │ ---- Found: 'bool'. But expected: 'u8', 'u16', 'u32', 'u64', 'u128', 'u256' | ||
= 6 │ │ x = x + 1; | ||
= 7 │ │ }; | ||
- │ ╰─────────^ Invalid argument to '+' | ||
+ │ ╰─────────^ | ||
= | ||
- error[E04003]: built-in operation not supported | ||
+ error: invalid call of `<`: expected `integer` but found `bool` for argument 1 | ||
= ┌─ TEMPFILE:5:9 | ||
= │ | ||
= 5 │ ╭ for (i in true..false) { | ||
- │ ---- Found: 'bool'. But expected: 'u8', 'u16', 'u32', 'u64', 'u128', 'u256' | ||
= 6 │ │ x = x + 1; | ||
= 7 │ │ }; | ||
- │ ╰─────────^ Invalid argument to '<' | ||
+ │ ╰─────────^ | ||
= | ||
= | ||
= |
6 changes: 6 additions & 0 deletions
6
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/for_user.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
processed 2 tasks | ||
|
||
task 1 'run'. lines 13-13: | ||
return values: 12 | ||
|
||
==> Compiler v2 delivered same results! |
7 changes: 5 additions & 2 deletions
7
...sts/move_check/control_flow/for_user.move → ...al-tests/tests/control_flow/for_user.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
//# publish | ||
module 0x42::test { | ||
fun for(i : u32, j: u32, k:u32) : u32 { | ||
fun for(i: u32, j: u32, k: u32) : u32 { | ||
i + j + k | ||
} | ||
fun for_user() : u32 { | ||
public fun for_user() : u32 { | ||
let (i, j, k) = (3, 4, 5); | ||
let x = for(i, j, k); | ||
x | ||
} | ||
} | ||
|
||
//# run 0x42::test::for_user |
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/loop_infinite.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
processed 1 task | ||
|
||
task 0 'run'. lines 1-10: | ||
Error: Script execution failed with VMError: { | ||
major_status: OUT_OF_GAS, | ||
sub_status: None, | ||
location: script, | ||
indices: redacted, | ||
offsets: redacted, | ||
} | ||
|
||
==> Compiler v2 delivered same results! |
10 changes: 10 additions & 0 deletions
10
third_party/move/move-compiler-v2/transactional-tests/tests/control_flow/loop_infinite.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//# run --gas-budget 700 | ||
script { | ||
fun main() { | ||
loop { | ||
loop break; | ||
}; | ||
if (true) () else (); | ||
assert!(false, 42); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...d_party/move/move-compiler-v2/transactional-tests/tests/control_flow/nested_for_loops.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
13 changes: 13 additions & 0 deletions
13
..._party/move/move-compiler-v2/transactional-tests/tests/control_flow/nested_for_loops.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//# run | ||
script { | ||
fun main(): () { | ||
let y = 0; | ||
for (i in 0..10) { | ||
y = y + 1; | ||
for (j in i..10) { | ||
y = y + 1; | ||
}; | ||
}; | ||
assert!(y == 65, 42); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...y/move/move-compiler-v2/transactional-tests/tests/control_flow/nested_for_while_loops.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
processed 1 task | ||
|
||
==> Compiler v2 delivered same results! |
Oops, something went wrong.