Lines 6-12
Link Here
|
6 |
use strict; |
6 |
use strict; |
7 |
use warnings; |
7 |
use warnings; |
8 |
|
8 |
|
9 |
use Test::More tests => 4; |
9 |
use Test::More tests => 8; |
10 |
|
10 |
|
11 |
BEGIN { |
11 |
BEGIN { |
12 |
use FindBin; |
12 |
use FindBin; |
Lines 25-27
like( $date_time, qr/^\d{8} \d{6}$/, 'Timestamp format secs');
Link Here
|
25 |
$date_time = Sip::timestamp('2011-01-12'); |
25 |
$date_time = Sip::timestamp('2011-01-12'); |
26 |
ok( $date_time eq '20110112 235900', 'Timestamp iso date string'); |
26 |
ok( $date_time eq '20110112 235900', 'Timestamp iso date string'); |
27 |
|
27 |
|
28 |
- |
28 |
my $myChecksum = Sip::Checksum::checksum("12345"); |
|
|
29 |
my $checker = 65281; |
30 |
my $stringChecksum = Sip::Checksum::checksum("teststring"); |
31 |
my $stringChecker = 64425; |
32 |
|
33 |
is( $myChecksum, $checker, "Checksum: $myChecksum matches expected output"); |
34 |
is( $stringChecksum, $stringChecker, "Checksum: $stringChecksum matches expected output"); |
35 |
|
36 |
my $testdata = "abcdAZ"; |
37 |
my $something = Sip::Checksum::checksum($testdata); |
38 |
|
39 |
$something = sprintf("%4X", $something); |
40 |
ok( Sip::Checksum::verify_cksum($testdata.$something), "Checksum: $something is valid."); |
41 |
|
42 |
my $invalidTest = Sip::Checksum::verify_cksum("1234567"); |
43 |
is($invalidTest, 0, "Checksum: 1234567 is invalid as expected"); |