copy pasting is bad, mmk?
[language-befunge.git] / t / 5-befunge / b-nums.t
blobb6f69801bfa167078992f5dd8d30219529d13ad0
1 #!perl
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 # -- numbers
13 use strict;
14 use warnings;
16 use Test::More tests => 34;
17 use Test::Output;
19 use Language::Befunge;
20 my $bef = Language::Befunge->new;
23 # empty stack
24 $bef->store_code( ',q' );
25 stdout_is { $bef->run_code } chr(0), 'empty stack, string output';
26 $bef->store_code( '.q' );
27 stdout_is { $bef->run_code } '0 ', 'empty stack, numeral output';
30 # all nums in order
31 foreach my $c ( 0 .. 9, 'a' .. 'f' ) {
32     my $n = hex $c;
33     $bef->store_code( "$c,q" );
34     stdout_is { $bef->run_code } chr($n), "$c, string output";
35     $bef->store_code( "$c.q" );
36     stdout_is { $bef->run_code } "$n ",   "$c, numeral output";