PLearn 0.1
Defines | Functions
assertions.cc File Reference
#include <iostream>
#include <assert.h>
#include <plearn/base/plerror.h>
#include <string>
Include dependency graph for assertions.cc:

Go to the source code of this file.

Defines

#define __FILE__   "assertions.cc"

Functions

int main ()

Define Documentation

#define __FILE__   "assertions.cc"

Definition at line 10 of file assertions.cc.

Referenced by PLearn::StructuralLearner::test().


Function Documentation

int main ( )

Definition at line 14 of file assertions.cc.

References PLearn::endl(), PLearn::PLearnError::message(), and PLASSERT.

{
  try {
    PLASSERT( 1 == 1 );
    PLASSERT( 3+8 == 123+46 );
  }
  catch (const PLearn::PLearnError& e)
  {
      string msg = e.message();
#ifdef WIN32
      // This is a hack so that the test passes under Windows: the assert
      // code unfortunatley does not have access to the function name, and thus
      // displays '(null)' instead of the correct name.
      size_t pos = msg.find("(null)");
      if (pos != string::npos)
          msg = msg.replace(pos, 6, "int main()");

#endif
    std::cerr << "FATAL ERROR: " << msg << std::endl;
  }
  return 0;
}

Here is the call graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines