stats/test/CheckStatus.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Bernd Machenschalk, Jolien Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 #include "CheckStatus.h"
00021 #include <stdio.h>
00022 #include <string.h>
00023 
00024 #include <lal/LALRCSID.h>
00025 NRCSID (CHECKSTATUSC,"$Id: CheckStatus.c,v 1.3 2007/06/08 14:41:52 bema Exp $");
00026 
00027 extern BOOLEAN optVerbose;
00028 
00029 INT4
00030 CheckStatus(LALStatus *status, const INT4 code, const CHAR *message,
00031             const INT4 exitcode, const CHAR *error)
00032 {
00033   
00034   if (optVerbose)
00035   {
00036     REPORTSTATUS (status);
00037   }
00038   if (status->statusCode!= code) 
00039   {
00040     if (code) printf ("  FAIL: did not recognize \"%s\"\n", message);
00041     if (optVerbose) printf("Exiting with error: %s\n", error);
00042     return(exitcode);
00043   }
00044   else if (code && strcmp(message, status->statusDescription)) 
00045   {
00046     printf("  FAIL: incorrect error message \"%s\" not \"%s\"\n",
00047            status->statusDescription, message);
00048     if (optVerbose) printf("Exiting with error: %s\n", error);
00049     return(exitcode);
00050   }
00051   return 0;
00052 }

Generated on Fri Sep 5 03:06:35 2008 for LAL by  doxygen 1.5.2