OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / oliasdb / olias_test.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * $XConsortium: olias_test.C /main/8 1996/10/26 18:20:03 cde-hal $
25  *
26  * Copyright (c) 1992 HAL Computer Systems International, Ltd.
27  * All rights reserved.  Unpublished -- rights reserved under
28  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
29  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
30  * OR DISCLOSURE.
31  * 
32  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
33  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
34  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
35  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
36  * INTERNATIONAL, LTD.
37  * 
38  *                         RESTRICTED RIGHTS LEGEND
39  * Use, duplication, or disclosure by the Government is subject
40  * to the restrictions as set forth in subparagraph (c)(l)(ii)
41  * of the Rights in Technical Data and Computer Software clause
42  * at DFARS 252.227-7013.
43  *
44  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
45  *                  1315 Dell Avenue
46  *                  Campbell, CA  95008
47  * 
48  */
49
50
51 #include "oliasdb/olias_test.h"
52 #include "api/utility.h"
53 #include "utility/pm_random.h"
54 #include "misc/unique_id.h"
55 #include "storage/vm_storage.h"
56 #include "dstr/dstr_test.h"
57 #include "storage/store_test.h"
58 #include "oliasdb/olias_funcs.h"
59
60 #include "object/random_gen.h"
61
62 #ifdef REGRESSION_TEST
63
64 #include "oliasdb/graphic_test.h"
65 #include "oliasdb/loc_test.h"
66 #include "oliasdb/stylesheet_test.h"
67 #include "oliasdb/dlp_test.h"
68 #include "oliasdb/mark_test.h"
69 #include "oliasdb/toc_test.h"
70 #include "oliasdb/doc_test.h"
71 #include "oliasdb/node_test.h"
72
73 #endif
74
75 #include "oliasdb/collectionIterator.h"
76 #include "oliasdb/mmdb.h"
77
78       
79 #ifdef NODEBUG
80 void test_collector_iterator(info_base* base)
81 {
82    MESSAGE(cerr, "node locators:");
83    nodeCollectionIterator x(base);
84
85    while ( ++x ) {
86      debug(cerr, x.get_locator());
87    }
88
89    MESSAGE(cerr, "stylesheet locators:");
90
91    stylesheetCollectionIterator y(base);
92
93    while ( ++y ) {
94      debug(cerr, y.get_locator());
95    }
96
97    MESSAGE(cerr, "locator set locators:");
98
99    locatorCollectionIterator z(base);
100
101    while ( ++z ) {
102      debug(cerr, z.get_locator());
103    }
104 }
105
106 int dump_instances(info_base* base_ptr, char* col_nm, c_code_t ins_code)
107 {
108    if ( base_ptr == 0 )
109       throw(stringException("null base ptr"));
110
111    Iterator *it = base_ptr -> first(col_nm, ins_code);
112   
113    if (it==0)
114       throw(stringException("null iterator pointer"));
115
116    int i = 0;
117
118    while ( *it ) {
119       oid_t id = base_ptr -> get_oid(*it);
120
121       if ( strcmp(col_nm, NODE_SET_NAME) == 0 ) {
122          i++;
123          node_smart_ptr x(base_ptr, id);
124          cout << x.data();
125          //debug(cerr, x.long_title());
126       } else 
127       if ( strcmp(col_nm, LOCATOR_SET_NAME) == 0 ) {
128          i++;
129          locator_smart_ptr x(base_ptr, id);
130          cout << x.inside_node_locator_str() << "\n";
131       } 
132       if ( strcmp(col_nm, GRAPHIC_SET_NAME) == 0 ) {
133          i++;
134          graphic_smart_ptr x(base_ptr, id);
135
136          if ( x.type() == 3 ) {
137             const char* ps_str = x.data();
138             cout << "\n";
139             cout << "\n";
140             cout << x.data_size() << "\t";
141             for ( int j=0; j<x.data_size(); j++ )
142                cout << ps_str[j];
143
144             cout << "\n";
145          }
146       } 
147
148       base_ptr -> next(*it);
149    }
150    debug(cerr, i);
151
152    delete it;
153
154    return 0;
155 }
156
157 int cache_test( info_lib* infolib_ptr, const char* base_name, int argc, char** argv )
158 {
159    locator_smart_ptrPtr* ptr_array = new locator_smart_ptrPtr[argc];
160 debug(cerr, argc);
161
162    int i;
163    for ( i=0; i<argc; i++ ) {
164       ptr_array[i] = new locator_smart_ptr(infolib_ptr, base_name, argv[i]);
165    
166       cerr << form("node_id of locator %s:\n", argv[i]);
167       ptr_array[i] -> node_id().asciiOut(cerr); cerr << "\n";
168       //debug(cerr, ptr_array[i] -> vcc_num());
169       cerr << "\n";
170    }
171
172    for ( i=0; i<argc; i++ ) {
173       delete ptr_array[i];
174    }
175    delete ptr_array;
176
177    return 0;
178 }
179
180 void dump_node_ids(info_base* x_base)
181 {
182    if ( x_base == 0 )
183      return;
184
185    int docs = x_base -> num_of_docs();
186
187    doc_smart_ptr* doc = 0;
188
189    node_smart_ptr* first_node = 0, *node = 0;
190    dlp_smart_ptr* x = 0, *dlp_cell = 0;
191
192    for ( int i=0; i<docs; i++ ) {
193       doc = new doc_smart_ptr(x_base, i+1);
194
195       debug(cerr, doc -> long_title());
196
197       first_node = new node_smart_ptr(x_base, doc -> locator_id());
198
199       dlp_cell = new dlp_smart_ptr(x_base, first_node -> its_oid());
200
201       while ( dlp_cell ) {
202
203          debug(cerr, dlp_cell -> node_id());
204
205          x = dlp_cell -> next();
206
207          delete dlp_cell;
208
209          dlp_cell = x;
210       }
211
212       delete doc;
213       delete first_node;
214    }
215 }
216
217
218 #endif
219
220 #ifdef REGRESSION_TEST
221
222 #define TEST_STY_FILE "test.sty"
223 #define TEST_SEC_FILE "test.sec"
224 #define TEST_MIX_FILE "test.mix"
225
226 int generate_stream(info_base* b_ptr, char* path, int num_sections, int min, int max)
227 {
228    random_gen x;
229
230    if ( check_and_create_dir(path) == false )
231      return -1;
232
233 // generate stylesheet stream
234
235    cerr << " stylesheets ..." << endl;
236    int stylesheets = x.pick_a_value(5, 20); // assume [5, 20] is the range
237
238    char buf[BUFSIZ];
239    snprintf(buf, sizeof(buf), "%s/%s", path, TEST_STY_FILE);
240    fstream stylesheet_stream(buf, ios::out);
241
242    if ( !stylesheet_stream )
243      return -1;
244
245    int i;
246    for (i=0; i<stylesheets; i++ ) {
247 // assume the stylesheet and section are of approx. length
248      generate_stylesheet_instance(x, stylesheet_stream, min, max);
249    }
250
251 // generate section stream
252
253    cerr << " sections ..." << endl;
254
255    snprintf(buf, sizeof(buf), "%s/%s", path, TEST_SEC_FILE);
256    fstream section_stream(buf, ios::out);
257
258    if ( !section_stream ) return -1;
259
260
261 // prepare mixed stream
262    snprintf(buf, sizeof(buf), "%s/%s", path, TEST_MIX_FILE);
263    fstream mix_stream(buf, ios::out);
264
265    if ( !mix_stream ) return -1;
266
267    for (i=0; i<num_sections; i++ )
268      generate_node_instance(b_ptr, x, section_stream, mix_stream, min, max);
269
270 // generate mixed stream
271    cerr << " docs ..." << endl;
272
273 // doc
274    int docs = x.pick_a_value(num_sections/4, num_sections/2);
275    for (i=0; i<docs; i++ ) {
276 // [docs/10, docs] is for the number of tab sections
277       //generate_doc_instance(x, mix_stream, i+1, docs/10, docs);
278       generate_doc_instance(x, mix_stream, i+1, 1, 10);
279    }
280
281 // toc
282    cerr << " tocs ..." << endl;
283    int tocs = docs;
284    for (i=0; i<tocs; i++ ) {
285 // [0, num_sections/10] is for the branch factor
286      generate_toc_instance(x, mix_stream, i, 0, num_sections/10);
287    }
288
289 // sgml 
290
291 // graphic
292    cerr << " graphics ..." << endl;
293    int graphics = x.pick_a_value(num_sections/2, 2*num_sections);
294    for (i=0; i<graphics; i++ )
295      generate_graphic_instance(b_ptr, x, mix_stream, min, max);
296
297 // locators 
298    cerr << " locators ..." << endl;
299    int locs = x.pick_a_value(num_sections, num_sections*5);
300    for (i=0; i<locs; i++ )
301      generate_loc_instance(x, mix_stream);
302
303    return 0;
304 }
305
306 int destroy_stream(char* path)
307 {
308    mtry {
309       del_file(TEST_STY_FILE, path);
310       del_file(TEST_SEC_FILE, path);
311       del_file(TEST_MIX_FILE, path);
312    }
313    mcatch_any()
314    {
315       return -1;
316    }
317    end_try;
318
319    return 0;
320 }
321
322 int extract_and_compare_objects(istream& in, info_base* base_ptr, int code)
323 {
324    int ok = 0;
325
326    handler* root_hd_ptr = 0;
327
328    vm_storage st((char*)"", (char*)"");
329
330    char ccode_buf[LBUFSIZ];
331    int c;
332    while ( (c = in.get()) != EOF ) {
333       in.putback(c);
334
335       in.getline(ccode_buf, LBUFSIZ);
336
337       sscanf(ccode_buf, "%u", &c);
338 //debug(cerr, c);
339 //fprintf(stderr, "code = %d\n", c);
340
341       if ( c == SGML_CONTENT_CODE ) {
342         if ( code == c || code == 0 )
343            ok |= compare_SGML_content(in, base_ptr, (Boolean)true);
344         else
345            compare_SGML_content(in, base_ptr, (Boolean)false);
346       } else {
347
348          root_hd_ptr = new handler(c, &st);
349    
350          (*root_hd_ptr) -> asciiIn(in);
351    
352          if ( code == c || code == 0 ) {
353             switch ( c ) {
354               case OLIAS_NODE_CODE :
355                  ok |= compare_node(*(node_smart_ptr*)root_hd_ptr, base_ptr);
356                  break;
357               case STYLESHEET_CODE :
358                  ok |= compare_stylesheet(*(stylesheet_smart_ptr*)root_hd_ptr, base_ptr);
359                  break;
360               case DOC_CODE :
361                  ok |= compare_doc(*(doc_smart_ptr*)root_hd_ptr, base_ptr);
362                  break;
363               case GRAPHIC_CODE :
364                  ok |= compare_graphic(*(graphic_smart_ptr*)root_hd_ptr, base_ptr);
365                  break;
366               case TOC_CODE :
367                  ok |= compare_toc(*(toc_smart_ptr*)root_hd_ptr, base_ptr);
368                  break;
369               case LOCATOR_CODE :
370                  ok |= compare_locator(*(locator_smart_ptr*)root_hd_ptr, base_ptr);
371                  break;
372               default:
373                  break;
374             }
375          }
376    
377          delete root_hd_ptr;
378       }
379       st.remove();
380    }
381    return ok;
382 }
383
384 struct {
385    char* name;
386    c_code_t code;
387 } auto_test_spec[] = 
388 {
389   {(char*)"auto_node_test", OLIAS_NODE_CODE},
390   {(char*)"auto_SGML_content_test", SGML_CONTENT_CODE},
391   {(char*)"auto_stylesheet_test", STYLESHEET_CODE},
392   {(char*)"auto_graphic_test", GRAPHIC_CODE},
393   {(char*)"auto_doc_test", DOC_CODE},
394   {(char*)"auto_toc_test", TOC_CODE},
395   {(char*)"auto_loc_test", LOCATOR_CODE},
396 };
397
398 #define NUM_OF_AUTO_TESTS 7
399
400 int auto_test(int argc, char** argv, OLIAS_DB& db)
401 {
402    int ok = 0;
403
404    info_lib* infolib_ptr = db.openInfoLib(argv[2]);
405
406 // define
407    if ( infolib_ptr == 0 ||
408         infolib_ptr->define_info_base(argv[4],argv[4],argv[3]) == false
409       ) {
410       STDERR_MESSAGE("creating test database failed\n");
411       return -1;
412    } else
413       STDERR_MESSAGE("creating test database done\n");
414
415    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
416
417 // randomly generate raw stream
418    infolib_ptr = db.openInfoLib(argv[2]);
419    info_base* base_ptr = infolib_ptr -> get_info_base(argv[4]);
420    ok = generate_stream(base_ptr, argv[2],
421                    atoi(argv[5]), atoi(argv[6]), atoi(argv[7])
422                   );
423    if ( ok != 0 ) {
424       STDERR_MESSAGE("generating test data failed\n");
425       return -1;
426    } else
427       STDERR_MESSAGE("generating test data done\n");
428
429    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
430
431 // load style sheet
432    cerr << " loading stylesheets ..." << endl;
433    char buf[256];
434    char file_name[256];
435    snprintf(buf, sizeof(buf), "%s.stylesheet", argv[4]);
436    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_STY_FILE);
437
438    infolib_ptr = db.openInfoLib(argv[2]);
439    base_ptr = infolib_ptr -> get_info_base(argv[4]);
440    ok = load( base_ptr, buf, file_name );
441
442    if ( ok != 0 ) {
443       STDERR_MESSAGE("loading test stylesheet data failed\n");
444       return -1;
445    } else
446       STDERR_MESSAGE("loading test stylesheet data done\n");
447
448    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
449
450
451 // load sections (small component)
452    cerr << " loading sections ..." << endl;
453    snprintf(buf, sizeof(buf), "%s.node", argv[4]);
454    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_SEC_FILE);
455
456    infolib_ptr = db.openInfoLib(argv[2]);
457    base_ptr = infolib_ptr -> get_info_base(argv[4]);
458    ok = load( base_ptr, buf, file_name );
459
460    if ( ok != 0 ) {
461       STDERR_MESSAGE("loading test section data failed\n");
462       return -1;
463    } else
464       STDERR_MESSAGE("loading test section data done\n");
465
466    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
467
468 // load all other objects
469    cerr << " loading all other objects ..." << endl;
470    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_MIX_FILE);
471    fstream in(file_name, ios::in);
472
473    if ( !in ) return -1;
474
475    infolib_ptr = db.openInfoLib(argv[2]);
476    base_ptr = infolib_ptr -> get_info_base(argv[4]);
477    ok = _load_mixed_objects(base_ptr, in);
478
479    if ( ok != 0 ) {
480       STDERR_MESSAGE("loading all other test data failed\n");
481       return -1;
482    } else
483       STDERR_MESSAGE("loading all other test data done\n");
484
485    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
486
487 // test
488            
489    infolib_ptr = db.openInfoLib(argv[2]);
490    base_ptr = infolib_ptr -> get_info_base(argv[4]);
491
492 // stylesheet
493    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_STY_FILE);
494    fstream ss_in(file_name, ios::in);
495
496    if ( !ss_in ) return -1;
497
498    ok = extract_and_compare_objects(ss_in, base_ptr, 0);
499
500    if ( ok != 0 ) {
501       STDERR_MESSAGE("testing stylesheet data failed\n");
502       return -1;
503    } else
504       STDERR_MESSAGE("testing stylesheet data done\n");
505
506 // node 
507    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_SEC_FILE);
508    fstream nd_in(file_name, ios::in);
509    if ( !nd_in ) return -1;
510
511    ok = extract_and_compare_objects(nd_in, base_ptr, 0);
512
513    if ( ok != 0 ) {
514       STDERR_MESSAGE("testing section failed\n");
515       return -1;
516    } else
517       STDERR_MESSAGE("testing section done\n");
518
519 // all other 
520    snprintf(file_name, sizeof(file_name), "%s/%s", argv[2], TEST_MIX_FILE);
521    fstream all_in(file_name, ios::in);
522    if ( !all_in ) return -1;
523
524    ok = extract_and_compare_objects(all_in, base_ptr, 0);
525
526    if ( ok != 0 ) {
527       STDERR_MESSAGE("testing all other data failed\n");
528       return -1;
529    } else
530       STDERR_MESSAGE("testing all other data done\n");
531
532    db.closeInfoLib(infolib_ptr->get_info_lib_uid());
533
534    if ( argc == 8 ||
535         ( argc == 9 && strcmp(argv[8], "true") == 0 ) )
536    {
537       db.destroy(argv[2]);
538       destroy_stream(argv[2]);
539    }
540
541    return ok;
542 }
543
544 #endif
545
546 int select_debug_routine(int argc, char** argv, OLIAS_DB& db)
547 {
548    int ok = 2;
549
550 #ifdef REGRESSION_TEST
551    if ( strcmp(argv[1], "auto_test") == 0 ) {
552
553       if (argc != 8 && argc != 9 ) {
554 //                      1            2           3            4             5
555         cerr << "usage: auto_test info_lib_path info_base_spec base_name number_of_sections max_section_size, min_section_size [true|false]\n"; 
556         return 1;
557       } else
558         return auto_test(argc, argv, db);
559
560    } 
561
562    ok =store_test(argc, argv);
563
564    if ( ok != 2 ) {
565       return ok;
566    } 
567
568    ok =dstr_test(argc, argv);
569
570    if ( ok != 2 ) {
571       return ok;
572    } 
573
574    ok =mark_test(argc, argv);
575 #ifdef NODEBUG
576    if (ok < 0) {
577      cerr << "mark_test failed." << endl;
578      return ok;
579    }
580    else
581      cerr << "mark_test done." << endl;
582 #else
583    if ( ok != 2 ) {
584       return ok;
585    } 
586 #endif
587
588    for ( int i=0; i<NUM_OF_AUTO_TESTS; i++ )
589    
590       if ( strcmp(argv[1], auto_test_spec[i].name) == 0 ) {
591         
592         if ( argc != 4 && argc != 3 ) {
593            cerr << " args: " << auto_test_spec[i].name ;
594            cerr << " base_name [stream_file_name]";
595            return 1;
596         }
597
598         info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
599
600         if ( argc == 4 ) {
601            fstream in(argv[3], ios::in);
602            return extract_and_compare_objects(in, base_ptr, auto_test_spec[i].code);
603         } else {
604            return extract_and_compare_objects(cin, base_ptr, auto_test_spec[i].code);
605         }
606       }
607 #endif
608
609 #ifdef NODEBUG
610    if ( strcmp(argv[1], "random_gen") == 0 ) {
611         if ( argc != 7 ) {
612            cerr << "random_gen args: " << "random_gen base_name path num_sections min_section_len max_sec_len\n";
613            return 1;
614         }
615        info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
616
617        return generate_stream(base_ptr, argv[3], atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
618    } else
619
620    if ( strcmp(argv[1], "test_iterator") == 0 ) {
621          info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
622         test_collector_iterator(base_ptr);
623         ok = 0;
624    } else 
625
626    if ( strcmp(argv[1], "dump_node_ids") == 0 ) {
627       if ( argc != 3 ) {
628          MESSAGE(cerr, "dump_node_ids args: dump_node_ids base_nm");
629       } else {
630          info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
631          dump_node_ids(base_ptr);
632          ok = 0;
633       }
634    } else 
635
636    if ( strcmp(argv[1], "dump_instances") == 0 ) {
637       if ( argc != 4 ) {
638          MESSAGE(cerr, "load args: dump_all_instance base_nm type");
639       } else {
640          info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
641
642          if ( strcmp(argv[3], "nodes") == 0 )
643             ok = dump_instances(base_ptr, NODE_SET_NAME, OLIAS_NODE_CODE);
644          else
645          if ( strcmp(argv[3], "locators") == 0 )
646             ok = dump_instances(base_ptr, LOCATOR_SET_NAME, LOCATOR_CODE);
647          else
648          if ( strcmp(argv[3], "graphics") == 0 )
649             ok = dump_instances(base_ptr, GRAPHIC_SET_NAME, GRAPHIC_CODE);
650       }
651    } else
652
653    if ( strcmp(argv[1], "file_load") == 0 ) {
654       if ( (argc-2) % 3 != 0 ) {
655          MESSAGE(cerr,
656            "load args: file_load [obj_type obj_name data_file]+");
657       } else {
658          info_base* base_ptr = db.openInfoLib() -> get_info_base(argv[2]);
659          ok = load( base_ptr, argv+2, argc-2 );
660       }
661
662    } else
663
664    if ( strcmp(argv[1], "loc_test") == 0 ) {
665       if ( argc != 4 ) {
666          MESSAGE(cerr,
667            "loc_test args: loc_test base_name loc_value");
668       } else {
669          ok = loc_test( db.openInfoLib(), argv[2], argv[3] );
670       }
671    
672    } else 
673    if ( strcmp(argv[1], "toc_test") == 0 ) {
674       if ( argc != 4 ) {
675          MESSAGE(cerr,
676            "toc_test args: toc_test base_name oid_str");
677       } else {
678          ok = toc_test( db.openInfoLib(), argv[2], argv[3] );
679       }
680    
681    } else 
682    if ( strcmp(argv[1], "graphic_test") == 0 ) {
683       if ( argc != 4 ) {
684          MESSAGE(cerr,
685            "graphic_test args: graphic_test base_name oid_str");
686       } else {
687          ok = graphic_test( db.openInfoLib(), argv[2], argv[3] );
688       }
689    
690    } else 
691    if ( strcmp(argv[1], "stylesheet_test_loc") == 0 ) {
692       if ( argc != 4 ) {
693          MESSAGE(cerr,
694            "stylesheet_test_loc args: stylesheet_test_loc base_name loc");
695       } else {
696          ok = stylesheet_test_loc( db.openInfoLib(), argv[2], argv[3] );
697       }
698    } else 
699    if ( strcmp(argv[1], "stylesheet_test_oid") == 0 ) {
700       if ( argc != 4 ) {
701          MESSAGE(cerr,
702            "stylesheet_test_oid args: stylesheet_test_oid base_name oid");
703       } else {
704          ok = stylesheet_test_oid( db.openInfoLib(), argv[2], argv[3] );
705       }
706    } else 
707    if ( strcmp(argv[1], "node_test_loc") == 0 ) {
708       if ( argc != 4 ) {
709          MESSAGE(cerr,
710            "node_test_loc args: node_test_loc base_name loc");
711       } else {
712          ok = node_test_loc( db.openInfoLib(), argv[2], argv[3] );
713       }
714    } else 
715
716    if ( strcmp(argv[1], "node_test_oid") == 0 ) {
717       if ( argc != 4 ) {
718          MESSAGE(cerr,
719            "node_test_oid args: node_test_oid base_name oid_str");
720       } else {
721          ok = node_test_oid( db.openInfoLib(), argv[2], argv[3] );
722       }
723    
724    } else 
725    if ( strcmp(argv[1], "dlp_test") == 0 ) {
726       if ( argc != 4 ) {
727          MESSAGE(cerr,
728            "dlp_test args: dlp_test base_name oid_str");
729       } else {
730          ok = dlp_test( db.openInfoLib(), argv[2], argv[3] );
731       }
732    
733    } else 
734    if ( strcmp(argv[1], "doc_test_oid") == 0 ) {
735       if ( argc != 4 ) {
736          MESSAGE(cerr,
737            "doc_test_oid args: doc_test_oid base_name oid_str");
738       } else {
739          ok = doc_test_oid( db.openInfoLib(), argv[2], argv[3] );
740       }
741    
742    } else 
743    if ( strcmp(argv[1], "doc_test_int") == 0 ) {
744       if ( argc != 4 ) {
745          MESSAGE(cerr,
746            "doc_test_int args: doc_test_int base_name int_str");
747       } else {
748          ok = doc_test_int( db.openInfoLib(), argv[2], argv[3] );
749       }
750    } 
751
752 #endif
753       
754    return ok;
755 }