"Fossies" - the Fresh Open Source Software Archive

Member "MIME-Base64-3.16/t/base64url.t" (27 Sep 2020, 615 Bytes) of package /linux/privat/MIME-Base64-3.16.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!perl -w
    2 
    3 use strict;
    4 use warnings;
    5 use Test qw(plan ok);
    6 
    7 use MIME::Base64 qw(encode_base64url decode_base64url);
    8 
    9 my @tests;
   10 while (<DATA>) {
   11     next if /^#/;
   12     chomp;
   13     push(@tests, [split]);
   14 }
   15 
   16 plan tests => 2 * @tests;
   17 
   18 for (@tests) {
   19     my($name, $input, $output) = @$_;
   20     print "# $name\n";
   21     ok(decode_base64url($input), $output);
   22     ok(encode_base64url($output), $input);
   23 }
   24 
   25 __END__
   26 # https://github.com/ptarjan/base64url/blob/master/tests.txt
   27 # Name <space> Input <space> Ouput <newline>
   28 len1 YQ a
   29 len2 YWE aa
   30 len3 YWFh aaa
   31 no_padding YWJj abc
   32 padding YQ a
   33 hyphen fn5- ~~~
   34 underscore Pz8_ ???