1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996, 2010 Oracle and/or its affiliates. All rights reserved.
7
# Historic Hsearch interface test.
8
# Use the first 1000 entries from the dictionary.
9
# Insert each with self as key and data; retrieve each.
10
# After all are entered, retrieve all; compare output to original.
11
# Then reopen the file, re-retrieve everything.
12
# Finally, delete everything.
13
proc hsearch { { nentries 1000 } } {
16
puts "HSEARCH interfaces test: $nentries"
18
# Create the database and open the dictionary
24
error_check_good hcreate [berkdb hcreate $nentries] 0
28
puts "\tHSEARCH.a: put/get loop"
29
# Here is the loop where we put and get each key/data pair
30
while { [gets $did str] != -1 && $count < $nentries } {
31
set ret [berkdb hsearch $str $str enter]
32
error_check_good hsearch:enter $ret 0
34
set d [berkdb hsearch $str 0 find]
35
error_check_good hsearch:find $d $str
40
puts "\tHSEARCH.b: re-get loop"
42
# Here is the loop where we retrieve each key
43
while { [gets $did str] != -1 && $count < $nentries } {
44
set d [berkdb hsearch $str 0 find]
45
error_check_good hsearch:find $d $str
49
error_check_good hdestroy [berkdb hdestroy] 0