]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl | |
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 6; | |
6 | BEGIN { use_ok('Slob') }; | |
7 | ||
8 | my $slob = Slob->new('t/freedict-01.slob'); | |
9 | ||
10 | my $nr_of_entries = $slob->ref_count; | |
11 | ||
12 | my $second_ref = $slob->seek_and_read_ref(4); | |
13 | my $bin = $slob->seek_and_read_storage_bin($second_ref->{bin_index}); | |
14 | ||
15 | is $second_ref->{key}, 'abacus'; | |
16 | is $second_ref->{bin_index}, 0; | |
17 | is $second_ref->{item_index}, 161; | |
18 | my $count = scalar @{$bin->{positions}}; | |
19 | is $count, 637; | |
20 | ||
21 | my $expected = <<'EOF'; | |
22 | <html><head><link href="~/css/default.css" rel="stylesheet" type="text/css"><link href="~/css/night.css" rel="alternate stylesheet" title="Night" type="text/css"></head><script src="~/js/styleswitcher.js"></script><body><div class="form"> | |
23 | <div class="orth">abacus</div><div class="pron">æbəkəs</div></div><ol class="sense single"><li class="sense"> | |
24 | <ol class="cit single"><li class="cit trans"> | |
25 | <ol class="quote single"><li class="quote">Rechenbrett</li></ol><div class="gramGrp"> | |
26 | <div class="gen">m</div></div></li></ol></li></ol></body></html> | |
27 | EOF | |
28 | chomp $expected; | |
29 | is $slob->get_entry_of_storage_bin($bin, $second_ref->{item_index}), $expected; |