-
Notifications
You must be signed in to change notification settings - Fork 2
/
02-assert.t
59 lines (48 loc) · 1.4 KB
/
02-assert.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!perl
use strict;
use warnings;
use Test::More;
use FIDO::Raw;
my $a = FIDO::Raw::Assert->new;
isa_ok $a, 'FIDO::Raw::Assert';
is $a->rp ('localhost'), "localhost";
my $id = $a->rp;
is $id, "localhost";
$a = FIDO::Raw::Assert->new;
$a->allow_cred ('a');
$a->allow_cred ('b');
$a->count (1);
$a->hmac_salt ('12345678901234561234567890123456');
is $a->authdata(), undef;
is $a->clientdata_hash(), undef;
is $a->sig(), undef;
is $a->rp(), undef;
is $a->hmac_secret (0), undef;
$a->clientdata_hash ('abc');
ok (!eval {$a->allow_cred (undef)});
ok (!eval {$a->clientdata_hash (undef)});
ok (!eval {$a->rp (undef)});
ok (!eval {$a->authdata (0, undef)});
ok (!eval {$a->authdata ('abc', undef)});
ok (!eval {$a->authdata_raw (undef, 0)});
ok (!eval {$a->authdata_raw (undef, 'abc')});
ok (!eval {$a->authdata_raw ('abc', 'abc')});
ok (!eval {$a->authdata_raw ('abc', 0)});
ok (!eval {$a->sigcount (undef)});
ok (!eval {$a->sigcount (-1)});
ok (!eval {$a->sig ('abc')});
ok (!eval {$a->sig (0, undef)});
ok (!eval {$a->user (undef)});
ok (!eval {$a->flags (undef)});
ok (!eval {$a->flags ('abc')});
ok (!eval {$a->id (undef)});
ok (!eval {$a->id (-1)});
ok (!eval {$a->id ('abc')});
ok (!eval {$a->hmac_salt (undef)});
ok (!eval {$a->count (-1)});
ok (!eval {$a->count ('abc')});
ok (!eval {$a->sig ('abc')});
ok (!eval {$a->flags (-1)});
ok (!eval {$a->verify (0, 0, undef)});
ok (!eval {$a->verify (0, 0, '')});
done_testing;