2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: loc_test.C /main/5 1996/10/26 18:19:23 cde-hal $ */
25 #ifdef REGRESSION_TEST
27 #include "oliasdb/loc_test.h"
29 #define LARGE_BUFSIZ 2048
32 void print_loc(locator_smart_ptr& x, ostream& out)
34 out << x.inside_node_locator_str();
35 x.node_id().asciiOut(out); out << "\n";
38 int compare_locator(locator_smart_ptr& pattern, info_base* base_ptr)
40 char pattern_buf[LARGE_BUFSIZ];
41 ostringstream pattern_out(pattern_buf, LARGE_BUFSIZ, ios::out);
42 print_loc(pattern, pattern_out);
44 locator_smart_ptr x( base_ptr, pattern.inside_node_locator_str());
45 char db_buf[LARGE_BUFSIZ];
46 ostringstream db_out(db_buf, LARGE_BUFSIZ, ios::out);
49 return compare_stream(pattern_out, db_out);
52 int loc_test( info_lib* infolib_ptr, const char* base_name, const char* loc )
54 locator_smart_ptr x( infolib_ptr, base_name, loc );
59 void generate_loc_instance(random_gen& x, ostream& out)
63 x.random_string(out, 15, 15); // locator
64 x.random_oid(out, 1001, 0); // id
65 x.random_string(out, 8, 255); // label