1#!perl -w
2
3use strict;
4use warnings;
5use Test qw(plan ok);
6
7use MIME::Base64 qw(encode_base64url decode_base64url);
8
9my @tests;
10while (<DATA>) {
11    next if /^#/;
12    chomp;
13    push(@tests, [split]);
14}
15
16plan tests => 2 * @tests;
17
18for (@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>
28len1 YQ a
29len2 YWE aa
30len3 YWFh aaa
31no_padding YWJj abc
32padding YQ a
33hyphen fn5- ~~~
34underscore Pz8_ ???
35