@@ -254,16 +254,33 @@ TEST(VirtualMachineTest, OP_FOREVER_LOOP)
254254TEST (VirtualMachineTest, OP_REPEAT_LOOP)
255255{
256256 static unsigned int bytecode[] = { OP_START, OP_CONST, 0 , OP_REPEAT_LOOP, OP_CONST, 1 , OP_PRINT, OP_LOOP_END, OP_HALT };
257- static Value constValues[] = { 3 , " test" };
257+ static Value constValues1[] = { 3 , " test" };
258+ static Value constValues2[] = { 4.5 , " test" };
259+ static Value constValues3[] = { 4.2 , " test" };
258260
259261 EngineMock engineMock;
260262 VirtualMachine vm (nullptr , &engineMock, nullptr );
261263 vm.setBytecode (bytecode);
262- vm.setConstValues (constValues );
264+ vm.setConstValues (constValues1 );
263265 testing::internal::CaptureStdout ();
264266 vm.run ();
265267 ASSERT_EQ (testing::internal::GetCapturedStdout (), " test\n test\n test\n " );
266268 ASSERT_EQ (vm.registerCount (), 0 );
269+
270+ // For #317
271+ vm.setConstValues (constValues2);
272+ testing::internal::CaptureStdout ();
273+ vm.reset ();
274+ vm.run ();
275+ ASSERT_EQ (testing::internal::GetCapturedStdout (), " test\n test\n test\n test\n test\n " );
276+ ASSERT_EQ (vm.registerCount (), 0 );
277+
278+ vm.setConstValues (constValues3);
279+ testing::internal::CaptureStdout ();
280+ vm.reset ();
281+ vm.run ();
282+ ASSERT_EQ (testing::internal::GetCapturedStdout (), " test\n test\n test\n test\n " );
283+ ASSERT_EQ (vm.registerCount (), 0 );
267284}
268285
269286TEST (VirtualMachineTest, OP_REPEAT_LOOP_INDEX)
0 commit comments