File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 11using Test
2- using GeometryOps. LoopStateMachine: @controlflow , Continue, Break
2+ using GeometryOps. LoopStateMachine: @controlflow , Action
33
44@testset " Continue action" begin
55 count = 0
66 f (i) = begin
77 count += 1
88 if i == 3
9- return Continue ( )
9+ return Action ( :continue )
1010 end
1111 count += 1
1212 end
2121 function f (i)
2222 count += 1
2323 if i == 3
24- return Break ( )
24+ return Action ( :break )
2525 end
2626 count += 1
2727 end
3131 @test count == 5 # Counts up to i=3, adding 2 for i=1,2 and 1 for i=3
3232end
3333
34+ @testset " Return action" begin
35+ f (i) = for j in 1 : 3
36+ i == j && @controlflow Action (:return , i)
37+ end
38+ @test f (1 ) == 1
39+ @test f (2 ) == 2
40+ @test f (3 ) == 3
41+ end
42+
43+ @testset " Full return action" begin
44+ f (i) = for j in 1 : 3
45+ i == j && @controlflow Action (:full_return , i)
46+ end
47+ @test f (1 ) == Action (:full_return , 1 )
48+ @test f (2 ) == Action (:full_return , 2 )
49+ @test f (3 ) == Action (:full_return , 3 )
50+ end
51+
3452@testset " Return value" begin
3553 results = Int[]
3654 for i in 1 : 3
You can’t perform that action at this time.
0 commit comments