Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Asserter.h

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: Asserter.h,v $
00027  * Date modified: $Date: 2003/03/06 17:11:59 $
00028  * Version:       $Revision: 1.5 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #ifndef _VRJ_TEST_ASSERTER_H
00034 #define _VRJ_TEST_ASSERTER_H
00035 
00036 #include <vrj/Test/TestFailure.h>
00037 #include <vrj/Test/Test.h>
00038 #include <vrj/Test/Message.h>
00039 
00040 namespace vrj {
00041 namespace test
00042 {
00043 
00044 namespace  Asserter
00045 {
00048    void fail( vrj::test::Test* test, vrj::test::Message message, std::string filename, int linenum )
00049    {
00050       throw vrj::test::TestFailure(test, message, filename, linenum);                
00051    }
00052 
00056    void failIf( bool shouldFail, vrj::test::Test* test, vrj::test::Message message, std::string filename, int linenum )
00057    {
00058       if( shouldFail )
00059          fail(test,message,filename,linenum);
00060    }
00061 }
00062 
00063 } }
00064 
00065 
00069 #define VRJTEST_ASSERT(condition)                                                 \
00070   ( vrj::test::Asserter::failIf( !(condition), this,                              \
00071                                  vrj::test::Message( "assertion failed",          \
00072                                                       "Expression: " #condition), \
00073                                  __FILE__, __LINE__ ) )
00074 
00075 
00076 #endif
00077 

Generated on Sun May 2 15:10:16 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002