3 # This Koha test module is a stub!
4 # Add more tests here!!!
9 use Test::More tests => 8;
13 use lib "$FindBin::Bin/../C4/SIP";
14 use_ok('C4::SIP::Sip');
17 my $date_time = Sip::timestamp();
18 like( $date_time, qr/^\d{8} \d{6}$/, 'Timestamp format no param');
22 $date_time = Sip::timestamp($t);
23 like( $date_time, qr/^\d{8} \d{6}$/, 'Timestamp format secs');
25 $date_time = Sip::timestamp('2011-01-12');
26 ok( $date_time eq '20110112 235900', 'Timestamp iso date string');
28 my $myChecksum = Sip::Checksum::checksum("12345");
30 my $stringChecksum = Sip::Checksum::checksum("teststring");
31 my $stringChecker = 64425;
33 is( $myChecksum, $checker, "Checksum: $myChecksum matches expected output");
34 is( $stringChecksum, $stringChecker, "Checksum: $stringChecksum matches expected output");
36 my $testdata = "abcdAZ";
37 my $something = Sip::Checksum::checksum($testdata);
39 $something = sprintf("%4X", $something);
40 ok( Sip::Checksum::verify_cksum($testdata.$something), "Checksum: $something is valid.");
42 my $invalidTest = Sip::Checksum::verify_cksum("1234567");
43 is($invalidTest, 0, "Checksum: 1234567 is invalid as expected");