From d5f297565427bd2eaa4748896b1bce93479a72ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Mon, 3 Nov 2008 20:12:27 +0100 Subject: [PATCH] fix repeat shenanigan (yet again) see mycology readme: ==== README ==== The specification does not say that the operand should be skipped over after execution. The only special case is when the amount of times to execute is zero. This means that 2k6 should indeed first push 2 sixes at the k, and then a third when encountering the 6 itself. This also means that there is no way to execute an instruction only once: 1k6 results in two sixes. (Another IP may certainly modify the 6 immediately after the k is executed, but that's a somewhat unlikely case and not exactly a good way to handle this limitation.) The spec is somewhat unclear on the entirety of k, but both of the above issues have been confirmed with Chris Pressey. ==== /README ==== --- t/5-befunge/e-flow.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/5-befunge/e-flow.t b/t/5-befunge/e-flow.t index 12e7f61..c3a2923 100644 --- a/t/5-befunge/e-flow.t +++ b/t/5-befunge/e-flow.t @@ -136,11 +136,11 @@ BEGIN { $tests += 2 }; # Repeat instruction (glurps). sel; # normal repeat. $bef->store_code( <<'END_OF_CODE' ); -572k.q +3572k.q END_OF_CODE $bef->run_code; $out = slurp; -ok( $out, "7 5 " ); +ok( $out, "7 5 3 " ); sel; # null repeat. $bef->store_code( <<'END_OF_CODE' ); 0k.q @@ -151,7 +151,8 @@ ok( $out, "" ); sel; # useless repeat. $bef->store_code( <<'END_OF_CODE' ); 5kv - > 1.q + > 1.q + >2.q END_OF_CODE $bef->run_code; $out = slurp; -- 2.11.4.GIT