3 # This file is part of Language::Befunge.
4 # Copyright (c) 2001-2008 Jerome Quelin, all rights reserved.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the same terms as Perl itself.
11 #-------------------------------------------------#
12 # Decision making instructions. #
13 #-------------------------------------------------#
16 use Language::Befunge;
17 use POSIX qw! tmpnam !;
25 my $bef = Language::Befunge->new;
28 # In order to see what happens...
31 open OUT, ">$file" or die $!;
37 open OUT, "<$file" or die $!;
50 $bef->store_code( <<'END_OF_CODE' );
57 $bef->store_code( <<'END_OF_CODE' );
64 $bef->store_code( <<'END_OF_CODE' );
70 BEGIN { $tests += 3 };
74 $bef->store_code( <<'END_OF_CODE' );
81 $bef->store_code( <<'END_OF_CODE' );
88 $bef->store_code( <<'END_OF_CODE' );
94 BEGIN { $tests += 3 };
97 sel; # left from north.
98 $bef->store_code( <<'END_OF_CODE' );
105 sel; # right from north
106 $bef->store_code( <<'END_OF_CODE' );
113 sel; # left from south.
114 $bef->store_code( <<'END_OF_CODE' );
121 sel; # right from south
122 $bef->store_code( <<'END_OF_CODE' );
129 BEGIN { $tests += 4 };
132 sel; # north from left.
133 $bef->store_code( <<'END_OF_CODE' );
141 sel; # south from left.
142 $bef->store_code( <<'END_OF_CODE' );
150 sel; # north from right.
151 $bef->store_code( <<'END_OF_CODE' );
159 sel; # south from right.
160 $bef->store_code( <<'END_OF_CODE' );
168 BEGIN { $tests += 4 };
170 # Compare (3 branches if).
172 $bef->store_code( <<'END_OF_CODE' );
181 $bef->store_code( <<'END_OF_CODE' );
190 $bef->store_code( <<'END_OF_CODE' );
198 BEGIN { $tests += 3 };
201 BEGIN { plan tests => $tests };