@@ -33,12 +33,12 @@ public void BreakpointTest2short()
3333 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
3434 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
3535 Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 2 ) ;
36- InterpreterExecutionSession step = result . Continue ( ) ;
37- Assert . IsNotNull ( step ) ;
38- Assert . IsFalse ( step . CanContinue ) ;
39- Assert . IsTrue ( step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
40- step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
41- Assert . IsTrue ( step . CurrentResult . MachineState . Current . Value == 1 ) ;
36+ result . Continue ( ) ;
37+ Assert . IsNotNull ( result ) ;
38+ Assert . IsFalse ( result . CanContinue ) ;
39+ Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
40+ result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
41+ Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 1 ) ;
4242 }
4343
4444 [ TestMethod ]
@@ -52,12 +52,12 @@ public void BreakpointTest2()
5252 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
5353 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
5454 Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 5 ) ;
55- InterpreterExecutionSession step = result . Continue ( ) ;
56- Assert . IsNotNull ( step ) ;
57- Assert . IsFalse ( step . CanContinue ) ;
58- Assert . IsTrue ( step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
59- step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
60- Assert . IsTrue ( step . CurrentResult . MachineState . Current . Value == 2 ) ;
55+ result . Continue ( ) ;
56+ Assert . IsNotNull ( result ) ;
57+ Assert . IsFalse ( result . CanContinue ) ;
58+ Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
59+ result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
60+ Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 2 ) ;
6161 }
6262
6363 [ TestMethod ]
@@ -71,13 +71,14 @@ public void BreakpointTest3short()
7171 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
7272 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
7373 Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 2 ) ;
74- InterpreterExecutionSession step = result . RunToCompletion ( ) ;
74+ InterpreterExecutionSession step = Brainf_ckInterpreter . InitializeSession ( script , String . Empty ) ;
75+ step . RunToCompletion ( ) ;
7576 Assert . IsNotNull ( step ) ;
7677 Assert . IsFalse ( step . CanContinue ) ;
7778 Assert . IsTrue ( step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
7879 step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
7980 Assert . IsTrue ( step . CurrentResult . MachineState . Current . Value == 2 ) ;
80- while ( result . CanContinue ) result = result . Continue ( ) ;
81+ while ( result . CanContinue ) result . Continue ( ) ;
8182 Assert . IsNotNull ( result ) ;
8283 Assert . IsFalse ( result . CanContinue ) ;
8384 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
@@ -96,12 +97,12 @@ public void BreakpointTest3()
9697 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
9798 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
9899 Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 5 ) ;
99- InterpreterExecutionSession step = result . RunToCompletion ( ) ;
100- Assert . IsNotNull ( step ) ;
101- Assert . IsFalse ( step . CanContinue ) ;
102- Assert . IsTrue ( step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
103- step . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
104- Assert . IsTrue ( step . CurrentResult . MachineState . Current . Value == 5 ) ;
100+ result . RunToCompletion ( ) ;
101+ Assert . IsNotNull ( result ) ;
102+ Assert . IsFalse ( result . CanContinue ) ;
103+ Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
104+ result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
105+ Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 5 ) ;
105106 }
106107
107108 [ TestMethod ]
@@ -115,12 +116,12 @@ public void BreakpointTest4()
115116 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
116117 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
117118 Assert . IsTrue ( result . CurrentResult . MachineState . Current . Value == 5 ) ;
118- result = result . Continue ( ) ;
119+ result . Continue ( ) ;
119120 Assert . IsNotNull ( result ) ;
120121 Assert . IsTrue ( result . CanContinue ) ;
121122 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
122123 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) ) ;
123- while ( result . CanContinue ) result = result . Continue ( ) ;
124+ while ( result . CanContinue ) result . Continue ( ) ;
124125 InterpreterResult test = Brainf_ckInterpreter . Run ( code . Aggregate ( String . Empty , ( s , v ) => s + v ) , String . Empty ) ;
125126 Assert . IsTrue ( test . MachineState . Current == result . CurrentResult . MachineState . Current ) ;
126127 }
@@ -134,12 +135,13 @@ public void BreakpointTest5()
134135 Assert . IsTrue ( result . CanContinue ) ;
135136 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
136137 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) ) ;
137- InterpreterExecutionSession completion = result . RunToCompletion ( ) ;
138+ InterpreterExecutionSession completion = Brainf_ckInterpreter . InitializeSession ( hello , String . Empty ) ;
139+ completion . RunToCompletion ( ) ;
138140 Assert . IsNotNull ( completion ) ;
139141 Assert . IsFalse ( completion . CanContinue ) ;
140142 Assert . IsTrue ( completion . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
141143 completion . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . TextOutput ) ) ;
142- while ( result . CanContinue ) result = result . Continue ( ) ;
144+ while ( result . CanContinue ) result . Continue ( ) ;
143145 Assert . IsFalse ( result . CanContinue ) ;
144146 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
145147 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . TextOutput ) ) ;
@@ -158,8 +160,9 @@ public void BreakpointTest6()
158160 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
159161 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
160162 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
161- InterpreterExecutionSession completion = result . RunToCompletion ( ) ;
162- while ( result . CanContinue ) result = result . Continue ( ) ;
163+ InterpreterExecutionSession completion = Brainf_ckInterpreter . InitializeSession ( script , String . Empty ) ;
164+ completion . RunToCompletion ( ) ;
165+ while ( result . CanContinue ) result . Continue ( ) ;
163166 Assert . IsNotNull ( completion ) ;
164167 Assert . IsFalse ( completion . CanContinue ) ;
165168 Assert . IsFalse ( result . CanContinue ) ;
@@ -184,8 +187,9 @@ public void BreakpointTest7()
184187 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
185188 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
186189 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
187- InterpreterExecutionSession completion = result . RunToCompletion ( ) ;
188- while ( result . CanContinue ) result = result . Continue ( ) ;
190+ InterpreterExecutionSession completion = Brainf_ckInterpreter . InitializeSession ( script , String . Empty ) ;
191+ completion . RunToCompletion ( ) ;
192+ while ( result . CanContinue ) result . Continue ( ) ;
189193 Assert . IsNotNull ( completion ) ;
190194 Assert . IsFalse ( completion . CanContinue ) ;
191195 Assert . IsFalse ( result . CanContinue ) ;
@@ -210,8 +214,9 @@ public void BreakpointTest8()
210214 Assert . IsTrue ( result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . Success ) &&
211215 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . BreakpointReached ) &&
212216 result . CurrentResult . ExitCode . HasFlag ( InterpreterExitCode . NoOutput ) ) ;
213- InterpreterExecutionSession completion = result . RunToCompletion ( ) ;
214- while ( result . CanContinue ) result = result . Continue ( ) ;
217+ InterpreterExecutionSession completion = Brainf_ckInterpreter . InitializeSession ( script , String . Empty ) ;
218+ completion . RunToCompletion ( ) ;
219+ while ( result . CanContinue ) result . Continue ( ) ;
215220 Assert . IsNotNull ( completion ) ;
216221 Assert . IsFalse ( completion . CanContinue ) ;
217222 Assert . IsFalse ( result . CanContinue ) ;
@@ -233,13 +238,17 @@ public void TestMethod9()
233238 const String argument = "9985" , result = "99 * 85 = 8415" ;
234239 InterpreterResult test = Brainf_ckInterpreter . Run ( script . Aggregate ( String . Empty , ( s , v ) => s + v ) , argument ) ;
235240 Assert . IsNotNull ( test ) ;
236- Assert . IsTrue ( test . HasFlag ( InterpreterExitCode . Success ) ) ;
241+ Assert . IsTrue ( test . ExitCode . HasFlag ( InterpreterExitCode . Success ) ) ;
237242 Assert . AreEqual ( test . Output , result ) ;
238243 InterpreterExecutionSession
239244 initial = Brainf_ckInterpreter . InitializeSession ( script , argument ) ,
240- skip2 = initial . Continue ( ) . Continue ( ) . RunToCompletion ( ) ,
241- direct = initial . RunToCompletion ( ) ;
242- while ( initial . CanContinue ) initial = initial . Continue ( ) ;
245+ skip2 = Brainf_ckInterpreter . InitializeSession ( script , argument ) ,
246+ direct = Brainf_ckInterpreter . InitializeSession ( script , argument ) ;
247+ skip2 . Continue ( ) ;
248+ skip2 . Continue ( ) ;
249+ skip2 . RunToCompletion ( ) ;
250+ direct . RunToCompletion ( ) ;
251+ while ( initial . CanContinue ) initial . Continue ( ) ;
243252 foreach ( InterpreterExecutionSession session in new [ ] { skip2 , direct , initial } )
244253 {
245254 Assert . IsNotNull ( session ) ;
0 commit comments