summaryrefslogtreecommitdiffstats
path: root/test/tstab.c
blob: 81f828761c989a109eebcbc320258d5a0c03b6ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*-------------------------------------------------------------------------
 * Copyright (C) 1997	National Center for Supercomputing Applications.
 *                      All rights reserved.
 *
 *-------------------------------------------------------------------------
 *
 * Created:		tstab.c
 * 			Aug  7 1997
 * 			Robb Matzke <matzke@llnl.gov>
 *
 * Purpose:		
 *
 * Modifications:	
 *
 *-------------------------------------------------------------------------
 */
#include "testhdf5.h"

#include "H5ACprivate.h"
#include "H5Fprivate.h"
#include "H5Gprivate.h"
#include "H5Oprivate.h"


/*-------------------------------------------------------------------------
 * Function:	test_stab
 *
 * Purpose:	Test symbol tables
 *
 * Return:	void
 *
 * Programmer:	Robb Matzke
 *		matzke@viper.llnl.gov
 *		Aug  7 1997
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void
test_stab (void)
{
   hatom_t	fid;
   hdf5_file_t	*f;
   H5G_entry_t	cwd, sub;
   int		i;
   haddr_t	addr;
   char		name[256];
   herr_t	status;
   int		nsyms = 5000;
   
   MESSAGE (5, print_func("Testing Symbol Tables\n"););

   /* create the file */
   fid = H5Fcreate ("tstab.h5", H5ACC_OVERWRITE, 0, 0);
   CHECK (fid, FAIL, "H5Fcreate");
   f = H5Aatom_object (fid);
   CHECK (f, NULL, "H5Aatom_object");

   /* create a new root symbol table */
   status = H5G_mkroot (f, 100);
   CHECK_I (status, "H5G_mkroot");

   /*
    * Create a directory that has so many entries that the root
    * of the B-tree ends up splitting.
    */
   status = H5G_new (f, NULL, NULL, "/big", nsyms*10+2, &cwd);
   CHECK_I (status, "H5G_new");
   addr = H5G_stab_new (f, &sub, 0);
   CHECK_I (addr, "H5G_stab_new");
   MESSAGE (8, print_func ("Address %lu\n", (unsigned long)addr););
   
   
   for (i=0; i<nsyms; i++) {
      sprintf (name, "sub%05d", i);
      MESSAGE (8, print_func ("%s\n", name););
#if 1
      status = H5G_insert (f, &cwd, NULL, name, &sub);
      CHECK_I (status, "H5G_insert");
#else
      status = H5G_stab_new (f, &sub, 0);
      CHECK_I (status, "H5G_stab_new");
      status = H5G_stab_insert (f, &cwd, name, &sub);
      CHECK_I (status, "H5G_stab_insert");
#endif
   }
   

   /* close the file */
   H5Fclose (fid);
}