8 use MogileFS::Util qw(error_code);
10 use MogileFS::Checksum;
11 use Digest::MD5 qw(md5 md5_hex);
13 my $sto = eval { temp_store(); };
17 plan skip_all => "Can't create temporary test database: $@";
21 $sto->set_checksum(6, 1, md5("asdf"));
22 my $hash = $sto->get_checksum(6);
23 my $csum = MogileFS::Checksum->new($hash);
24 is(md5_hex("asdf"), $csum->hexdigest);
25 is("MD5", $csum->checksumname);
27 my $zero = "MD5:d41d8cd98f00b204e9800998ecf8427e";
28 $csum = MogileFS::Checksum->from_string(6, $zero);
29 is("MogileFS::Checksum", ref($csum), "is a ref");
30 is("d41d8cd98f00b204e9800998ecf8427e", $csum->hexdigest, "hex matches");
31 is(1, $csum->save, "save successfully");
32 $hash = $sto->get_checksum(6);
33 my $reloaded = MogileFS::Checksum->new($hash);
34 is("d41d8cd98f00b204e9800998ecf8427e", $reloaded->hexdigest, "hex matches");