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.

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 }

References unit_assert_throws.

Referenced by main().

◆ main()

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

Definition at line 48 of file ExceptionTest.cpp.

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 }

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

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 32 of file ExceptionTest.cpp.

Referenced by main().

unit_assert_throws
#define unit_assert_throws(x, exception)
Definition: unit.hpp:106
TEST_EPILOG
#define TEST_EPILOG
Definition: unit.hpp:183
test
void test()
Definition: ExceptionTest.cpp:35
os_
ostream * os_
Definition: ExceptionTest.cpp:32
TEST_FAILED
#define TEST_FAILED(x)
Definition: unit.hpp:177
TEST_PROLOG
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:175