Codebase list libcryptx-perl / v0.057 _generators / Mac.t.tt
v0.057

Tree @v0.057 (Download .tar.gz)

Mac.t.tt @v0.057raw · history · blame

[%comment%]

use strict;
use warnings;

[%- IF t_strings_count %]
use Test::More tests => [%t_strings_count * 6%] + 8;
[%- ELSE %]
use Test::More tests => 0;
[%- END %]

use Crypt::Mac::[%orig_name%] qw( [%lc_name%] [%lc_name%]_hex [%lc_name%]_b64 [%lc_name%]_b64u );

[%- FOREACH v IN t_strings %]
is( unpack('H*', Crypt::Mac::[%orig_name%]->new([%v.args%])->add([%v.data%])->mac), '[%v.mac%]', '[%orig_name%]/oo+raw/[%loop.count%]');
is( Crypt::Mac::[%orig_name%]->new([%v.args%])->add([%v.data%])->hexmac, '[%v.mac%]', '[%orig_name%]/oo+hex/[%loop.count%]');
is( unpack('H*', [%lc_name%]([%v.args%],[%v.data%])), '[%v.mac%]', '[%orig_name%]/func+raw/[%loop.count%]');
is( [%lc_name%]_hex([%v.args%],[%v.data%]), '[%v.mac%]', '[%orig_name%]/func+hex/[%loop.count%]');
is( [%lc_name%]_b64([%v.args%],[%v.data%]), '[%v.b64mac%]', '[%orig_name%]/func+b64/[%loop.count%]');
is( [%lc_name%]_b64u([%v.args%],[%v.data%]), '[%v.b64umac%]', '[%orig_name%]/func+b64u/[%loop.count%]');
[%- END %]

is( unpack('H*', Crypt::Mac::[%orig_name%]->new([%tripple_A.args%])->add("A","A","A")->mac), '[%tripple_A.hexmac%]', '[%orig_name%]/oo+raw/tripple_A');
is( unpack('H*', Crypt::Mac::[%orig_name%]->new([%tripple_A.args%])->add("A")->add("A")->add("A")->mac), '[%tripple_A.hexmac%]', '[%orig_name%]/oo3+raw/tripple_A');
is( Crypt::Mac::[%orig_name%]->new([%tripple_A.args%])->add("A","A","A")->hexmac, '[%tripple_A.hexmac%]', '[%orig_name%]/oo+hex/tripple_A');
is( Crypt::Mac::[%orig_name%]->new([%tripple_A.args%])->add("A")->add("A")->add("A")->hexmac, '[%tripple_A.hexmac%]', '[%orig_name%]/oo3+hex/tripple_A');
is( unpack('H*', [%lc_name%]([%tripple_A.args%],"A","A","A")), '[%tripple_A.hexmac%]', '[%orig_name%]/func+raw/tripple_A');
is( [%lc_name%]_hex ([%tripple_A.args%],"A","A","A"), '[%tripple_A.hexmac%]',  '[%orig_name%]/func+hex/tripple_A');
is( [%lc_name%]_b64 ([%tripple_A.args%],"A","A","A"), '[%tripple_A.b64mac%]',  '[%orig_name%]/func+b64/tripple_A');
is( [%lc_name%]_b64u([%tripple_A.args%],"A","A","A"), '[%tripple_A.b64umac%]', '[%orig_name%]/func+b64u/tripple_A');