1
# See the file LICENSE for redistribution information.
3
# Copyright (c) 1996-2001
4
# Sleepycat Software. All rights reserved.
6
# $Id: hsearch.tcl,v 11.8 2001/01/25 18:23:04 bostic Exp $
8
# Historic Hsearch interface test.
9
# Use the first 1000 entries from the dictionary.
10
# Insert each with self as key and data; retrieve each.
11
# After all are entered, retrieve all; compare output to original.
12
# Then reopen the file, re-retrieve everything.
13
# Finally, delete everything.
14
proc hsearch { { nentries 1000 } } {
17
puts "HSEARCH interfaces test: $nentries"
19
# Create the database and open the dictionary
25
error_check_good hcreate [berkdb hcreate $nentries] 0
29
puts "\tHSEARCH.a: put/get loop"
30
# Here is the loop where we put and get each key/data pair
31
while { [gets $did str] != -1 && $count < $nentries } {
32
set ret [berkdb hsearch $str $str enter]
33
error_check_good hsearch:enter $ret 0
35
set d [berkdb hsearch $str 0 find]
36
error_check_good hsearch:find $d $str
41
puts "\tHSEARCH.b: re-get loop"
43
# Here is the loop where we retrieve each key
44
while { [gets $did str] != -1 && $count < $nentries } {
45
set d [berkdb hsearch $str 0 find]
46
error_check_good hsearch:find $d $str
50
error_check_good hdestroy [berkdb hdestroy] 0