PLearn 0.1
|
Go to the source code of this file.
Defines | |
#define | __FILE__ "assertions.cc" |
Functions | |
int | main () |
#define __FILE__ "assertions.cc" |
Definition at line 10 of file assertions.cc.
Referenced by PLearn::StructuralLearner::test().
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; }