/*
* Copyright (c) 2000-2002 Proofpoint, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*/
/*
** Abstractions for writing libsm test programs.
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
extern char *optarg;
extern int optind;
extern int optopt;
extern int opterr;
int SmTestIndex;
int SmTestNumErrors;
bool SmTestVerbose;
%s [-h] [-d debugging] [-v]\n\
\n\
%s\n\
\n\
-h Display this help information.\n\
-d debugging Set debug activation levels.\n\
-v Verbose output.\n\
";
Usage: %s [-h] [-v]\n\
Use %s -h for help.\n\
";
/*
** SM_TEST_BEGIN -- initialize test system.
**
** Parameters:
** argc -- argument counter.
** argv -- argument vector.
** testname -- description of tests.
**
** Results:
** none.
*/
void
int argc;
char **argv;
char *testname;
{
int c;
SmTestIndex = 0;
SmTestNumErrors = 0;
SmTestVerbose = false;
opterr = 0;
{
switch (c)
{
case 'v':
SmTestVerbose = true;
break;
case 'd':
break;
case 'h':
exit(0);
default:
"Unknown command line option -%c\n",
optopt);
exit(1);
}
}
}
/*
** SM_TEST -- single test.
**
** Parameters:
** success -- did test succeeed?
** expr -- expression that has been evaluated.
** filename -- guess...
** lineno -- line number.
**
** Results:
** value of success.
*/
bool
bool success;
char *expr;
char *filename;
int lineno;
{
++SmTestIndex;
if (SmTestVerbose)
if (!success)
{
if (!SmTestVerbose)
expr);
}
else
{
if (SmTestVerbose)
}
return success;
}
/*
** SM_TEST_END -- end of test system.
**
** Parameters:
** none.
**
** Results:
** number of errors.
*/
int
{
if (SmTestNumErrors != 0)
return SmTestNumErrors;
}