ProteoWizard
Functions | Variables
ExceptionTest.cpp File Reference
#include "Std.hpp"
#include "Exception.hpp"
#include "unit.hpp"
#include <cassert>

Go to the source code of this file.

Functions

void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

§ test()

void test ( )

Definition at line 35 of file ExceptionTest.cpp.

References unit_assert_throws.

Referenced by main().

36 {
37 #ifndef NDEBUG
38  boost::shared_ptr<int> foo;
39  unit_assert_throws(*foo, runtime_error);
40 #endif
41 
42 #ifdef _DEBUG
43  unit_assert_throws(_ASSERTE(1+1 == 4), runtime_error);
44 #endif
45 }
#define unit_assert_throws(x, exception)
Definition: unit.hpp:106

§ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 48 of file ExceptionTest.cpp.

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.

49 {
50  TEST_PROLOG(argc, argv)
51 
52  try
53  {
54  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
55  if (os_) *os_ << "ExceptionTest\n";
56  test();
57  }
58  catch (exception& e)
59  {
60  TEST_FAILED(e.what())
61  }
62  catch (...)
63  {
64  TEST_FAILED("Caught unknown exception.")
65  }
66 
68 }
ostream * os_
void test()
#define TEST_EPILOG
Definition: unit.hpp:182
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 32 of file ExceptionTest.cpp.

Referenced by main().