Lingua-Shakespeare
view release on metacpan or search on metacpan
t/fibonacci2.t view on Meta::CPAN
#!perl
use Test::More tests => 2;
require "t/common.pl";
my $expect = join("",<DATA>);
my $buffer = tie *OUT, 'Handle';
select OUT;
my $ok = require "examples/fibonacci2.spl";
select STDOUT;
ok($ok);
is($$buffer,$expect);
__DATA__
0
1
1
2
3
use Test::More tests => 2;
require "t/common.pl";
my $buffer = tie *OUT, 'Handle';
my $input = tie *STDIN, 'Handle';
$$input = ">><><>>><=";
my $expect = join("\r\n", qw(500? 750? 875? 812? 843? 827? 835? 839? 841? 840? 840),'');
select OUT;
my $ok = require "examples/guess.spl";
select STDOUT;
ok($ok);
is($$buffer,$expect);
#!perl
use Test::More tests => 2;
require "t/common.pl";
my $buffer = tie *OUT, 'Handle';
select OUT;
my $ok = require "examples/hello.spl";
select STDOUT;
ok($ok);
is($$buffer,"Hello World!\n");
require "t/common.pl";
my $buffer = tie *OUT, 'Handle';
my $input = tie *STDIN, 'Handle';
$$input = "100\n";
my $expect = ">" . join("\n", qw(2 3 5 7 11 13 17 19 23 29 31 37 41 43
47 53 59 61 67 71 73 79 83 89 97)) . "\n";
select OUT;
my $ok = require "examples/primes.spl";
select STDOUT;
ok($ok);
is($$buffer,$expect);
t/reverse.t view on Meta::CPAN
use Test::More tests => 2;
require "t/common.pl";
my $buffer = tie *OUT, 'Handle';
my $input = tie *STDIN, 'Handle';
$$input = "abcdefghi";
my $expect = reverse $$input;
select OUT;
my $ok = require "examples/reverse.spl";
select STDOUT;
ok($ok);
is($$buffer,$expect);
t/shakesbeer.t view on Meta::CPAN
my $buffer = tie *OUT, 'Handle';
my $input = tie *STDIN, 'Handle';
$$input = "abcdefghi";
chomp(my @data = <DATA>);
my $expect = join("\r\n",@data,'');
select OUT;
my $ok = require "examples/shakesbeer.spl";
select STDOUT;
ok($ok);
is($$buffer,$expect);
__DATA__
99 bottles of beer on the wall, 99 bottles of beer.
Take one down, pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
Take one down, pass it around, 97 bottles of beer on the wall.
97 bottles of beer on the wall, 97 bottles of beer.
( run in 0.558 second using v1.01-cache-2.11-cpan-05444aca049 )