]> iEval git - convert-base91.git/blame - t/Convert-Base91.t
Better tests
[convert-base91.git] / t / Convert-Base91.t
CommitLineData
1a1c8cd6
MG
1#!/usr/bin/perl
2use strict;
3use warnings;
4
0ca5f559 5use Test::More tests => 9;
1a1c8cd6
MG
6BEGIN { use_ok('Convert::Base91', qw/encode_base91 decode_base91/) };
7
8is encode_base91("Hello, World!\n"), '>OwJh>}AQ;r@@Y?FF', 'encode';
9is decode_base91('>OwJh>}AQ;r@@Y?FF'), "Hello, World!\n", 'decode';
10
11my $str = 'abc_def';
12is decode_base91(encode_base91($str)), $str, 'roundtrip';
13
14my $base91 = Convert::Base91->new;
15$base91->encode('Hello, ');
16$base91->encode('World!');
17$base91->encode("\n");
18my $encoded = $base91->encode_end;
19is $encoded, '>OwJh>}AQ;r@@Y?FF', 'OO encode';
20
21$base91->decode('>OwJh>}AQ');
22$base91->decode(';r@@Y?FF');
23my $decoded = $base91->decode_end;
24is $decoded, "Hello, World!\n", 'OO decode';
0ca5f559
MG
25
26is $base91->decode_end, '', 'double decode_end';
27is $base91->encode_end, '', 'encode_end without data';
28
29is decode_base91(">\x00OwJh\x01>}A\xFE\xDDQ;r@\@Y?FF\x05"), "Hello, World!\n", 'decode with junk';
This page took 0.023309 seconds and 4 git commands to generate.