3 # This file is part of Language::Befunge.
4 # Copyright (c) 2001-2009 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.
16 use Test::More tests => 7;
19 use Language::Befunge;
20 my $bef = Language::Befunge->new;
24 $bef->store_code( '12345$..q' );
25 stdout_is { $bef->run_code } '4 3 ', 'pop, normal';
26 $bef->store_code( '$..q' );
27 stdout_is { $bef->run_code } '0 0 ', 'pop, empty stack';
31 $bef->store_code( '4:..q' );
32 stdout_is { $bef->run_code } '4 4 ', 'duplicate, normal';
33 $bef->store_code( ':..q' );
34 stdout_is { $bef->run_code } '0 0 ', 'duplicate, empty stack';
38 $bef->store_code( '34\..q' );
39 stdout_is { $bef->run_code } '3 4 ', 'swap stack, normal';
40 $bef->store_code( '3\..q' );
41 stdout_is { $bef->run_code } '0 3 ', 'swap stack, empty stack';
45 $bef->store_code( '12345678"azertyuiop"n..q' );
46 stdout_is { $bef->run_code } '0 0 ', 'clear stack';