/[jsFind]/trunk/t/03insert.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/03insert.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Sun Jul 11 20:18:25 2004 UTC (19 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1619 byte(s)
initial import into subversion of version 0.1

1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 3;
7 use blib;
8 use jsFind;
9
10 BEGIN { use_ok('jsFind'); }
11
12 my $t = new jsFind B => 4;
13
14 my $i = 0;
15 foreach my $k (qw{
16 minima ut dolorem sapiente voluptatemMaiores enim officiis qui veniam ducimus dolores. Voluptas facilis culpa rerum velit quaerat magni omnis.Placeat quia omnis non veritatis autem qui quasi reprehenderit. Et hic fugit et. Sunt voluptates nostrum et distinctio architecto quas.
17
18 Vel hic delectus velit occaecati modi possimus. Iste quis repellendus sequi. Ut voluptatem sed expedita ipsum ut delectus. Ab aspernatur animi corrupti excepturi earum odio. Incidunt repellat reprehenderit labore quisquam corrupti sapiente et cumque. Quia id quod et dolor aut expedita atque porro.
19
20 Porro porro veritatis enim consectetur. Veniam doloremque culpa nobis assumenda corporis. Corporis ducimus sed sint. Quod quo repellat earum.
21 }) {
22 $t->B_search(Key => $k,
23 Data => { "path" => {
24 t => "word $k",
25 f => $i },
26 },
27 Insert => 1,
28 Append => 1,
29 );
30 $i++;
31 }
32
33 if (open(T,"| sort > tree.txt")) {
34 print T $t->to_string;
35 print STDERR "tree saved in tree.txt\n";
36 close(T);
37 }
38
39 my $tree_size = 0;
40 open(T, "tree.txt") || die "can't open tree.txt: $!";
41 while(<T>) {
42 $tree_size++;
43 }
44
45 cmp_ok($tree_size, '==', 85, "insert $tree_size/$i");
46
47 if (open(T,"> tree.dot")) {
48 print T $t->to_dot;
49 print STDERR "Graphviz tree saved in tree.dot\n";
50 close(T);
51 }
52
53 my $r = $t->B_search(Key => "velit",
54 Data => { "path" => {
55 t => "new velit",
56 f => 99 }
57 },
58 Replace => 1,
59 );
60
61 cmp_ok(keys %{$r}, '==', 1, "replace");
62
63 #$t->to_jsfind('./html');

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26