1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/stdcpp/tsrc/Stdcpp_test/stdcxx/include/driver.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,154 @@
1.4 +/************************************************************************
1.5 + *
1.6 + * driver.h - testsuite driver declarations
1.7 + *
1.8 + * $Id: driver.h 287304 2005-09-15 00:41:16Z sebor $
1.9 + *
1.10 + ***************************************************************************
1.11 + *
1.12 + * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
1.13 + * Software division. Licensed under the Apache License, Version 2.0 (the
1.14 + * "License"); you may not use this file except in compliance with the
1.15 + * License. You may obtain a copy of the License at
1.16 + * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
1.17 + * applicable law or agreed to in writing, software distributed under
1.18 + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1.19 + * CONDITIONS OF ANY KIND, either express or implied. See the License
1.20 + * for the specific language governing permissions and limitations under
1.21 + * the License.
1.22 + *
1.23 + **************************************************************************/
1.24 +
1.25 +#ifndef RW_DRIVER_H_INCLUDED
1.26 +#define RW_DRIVER_H_INCLUDED
1.27 +
1.28 +#include <testdefs.h> // for test config macros
1.29 +extern int failures;
1.30 +
1.31 +/**
1.32 + * Initializes the test driver, passes program arguments to it, processes
1.33 + * command line arguments, any arguments specified in the environment
1.34 + * variable RWSTD_TESTOPTS, and if successful, invokes the program-supplied
1.35 + * callback function.
1.36 + *
1.37 + * @param argc The number of non-null elements in the argv array.
1.38 + * @param argv A null-terminated array of command line arguments.
1.39 + * If (argc == 0) the argument may be null.
1.40 + * @param filename The name of the source file name, typically
1.41 + * the __FILE__ macro. The argument may be null.
1.42 + * @param clause The clause exercised by the program, such as
1.43 + * lib.basic.string. The argument may be null.
1.44 + * @param comment An optional comment describing in more detail
1.45 + * the functionality of the program. The argument may be null.
1.46 + * @param testfun A pointer to a callback function to call by the
1.47 + * driver after successful initialization. The argument must
1.48 + * not be null.
1.49 + * @param optspec An optional character string describing command
1.50 + * line options accepted by the program. The argument may
1.51 + * be null.
1.52 + * @param ... Optional list of handlers of command line options
1.53 + * corresponding to the optspec.
1.54 + *
1.55 + * @return If initialization is successful, returns the value returned
1.56 + * by the callback function. Otherwise, returns the non-zero
1.57 + * value returned by the last initialization function or
1.58 + * command line option handler.
1.59 + *
1.60 + * After the driver has been initialzied the user-supplied callback function
1.61 + * may call any of the driver diagnostic functions to record and perhaps also
1.62 + * issue diagnostic messages of varying severity.
1.63 + *
1.64 + * There are 10 levels of severity with 0 being the lowest and 9 the highest.
1.65 + * Diagnostics of all levels of severity come in two states: active and
1.66 + * inactive. All diagnostics are recorded but normally only active diagnostics
1.67 + * of severity 4 or above are issued. It is possible to cause diagnostics of
1.68 + * lower severity levels to be issued via a command line option to the driver.
1.69 + * Choosing to issue severity 0 diagnostics has the effect of issuing inactive
1.70 + * diagnostics.
1.71 + *
1.72 + * After the callback function returns the driver displays a summary detailing
1.73 + * the number of recorded diagnostics in each of the two states (active and
1.74 + * inactive).
1.75 + *
1.76 + */
1.77 +_TEST_EXPORT int
1.78 +rw_test (int argc,
1.79 + char* argv[],
1.80 + const char* filename,
1.81 + const char* clause,
1.82 + const char* comment,
1.83 + int (*testfun)(int, char**),
1.84 + const char* optspec,
1.85 + ...);
1.86 +
1.87 +/**
1.88 + * Records and optionally issues a diagnostic of the highest severity 9.
1.89 + *
1.90 + * @param expr A zero value denoting an active diagnostic or any non-zero
1.91 + * vaue denoting an inactive diagnostic.
1.92 + * @param filename An optional name of the file invoking the function.
1.93 + * The argument may be null.
1.94 + * @param line When positive, denotes the line number of the location
1.95 + * relevant to the diagnostic. Negative values are ignored.
1.96 + * @param fmtspec A printf format specifier (with extensions) used
1.97 + * to format the text of the diagnostic.
1.98 + * @param ... Optional list of values to format.
1.99 + *
1.100 + * @return Returns the value of expr passed to it.
1.101 + *
1.102 + * Every diagnostic is recorded but only active diagnostics may be issued,
1.103 + * depending on the setting of the diagnosable severity. The value of the
1.104 + * first argument determines whether a diagnostc is active or inactive.
1.105 + * Unlike the remaining diagnostic functions, rw_fatal doesn't return to
1.106 + * the caller when expr is 0 (i.e., when the diagnostic is active).
1.107 + * Instead, it causes the driver the exit the process with the staus equal
1.108 + * to 9, the severity of the diagnostic.
1.109 + */
1.110 +_TEST_EXPORT int
1.111 +rw_fatal (int expr,
1.112 + const char* filename,
1.113 + int line,
1.114 + const char* fmtspec,
1.115 + ...);
1.116 +
1.117 +/**
1.118 + * Records and optionally issues a diagnostic of severity 8.
1.119 + *
1.120 + * @see #rw_fatal
1.121 + */
1.122 +_TEST_EXPORT int
1.123 +rw_error (int, const char*, int, const char*, ...);
1.124 +
1.125 +/**
1.126 + * Records and optionally issues a diagnostic of severity 7.
1.127 + *
1.128 + * @see #rw_fatal
1.129 + */
1.130 +_TEST_EXPORT int
1.131 +rw_assert (int, const char*, int, const char*, ...);
1.132 +
1.133 +/**
1.134 + * Records and optionally issues a diagnostic of severity 5.
1.135 + *
1.136 + * @see #rw_fatal
1.137 + */
1.138 +_TEST_EXPORT int
1.139 +rw_warn (int, const char*, int, const char*, ...);
1.140 +
1.141 +/**
1.142 + * Records and optionally issues a diagnostic of severity 2.
1.143 + *
1.144 + * @see #rw_fatal
1.145 + */
1.146 +_TEST_EXPORT int
1.147 +rw_note (int, const char*, int, const char*, ...);
1.148 +
1.149 +/**
1.150 + * Records and optionally issues a diagnostic of severity 1.
1.151 + *
1.152 + * @see #rw_fatal
1.153 + */
1.154 +_TEST_EXPORT int
1.155 +rw_info (int, const char*, int, const char*, ...);
1.156 +
1.157 +#endif // RW_DRIVER_H_INCLUDED