Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Header <boost/test/framework.hpp>

Defines Unit Test Framework mono-state interfaces. The framework interfaces are based on Monostate design pattern.


BOOST_TEST_SETUP_ASSERT(cond, msg)
namespace boost {
  namespace unit_test {
    typedef test_suite *(* init_unit_test_func;
    namespace framework {
      struct context_generator;
      struct internal_error;
      struct setup_error;
      struct nothing_to_test;
      void init(init_unit_test_func, int, char *);
      void finalize_setup_phase(test_unit_id = INV_TEST_UNIT_ID);

      // This function returns true when testing is in progress (setup is finished). 
      bool test_in_progress();
      void shutdown();
      test_suite & current_auto_test_suite(test_suite * = 0, bool = true);
      void register_test_unit(test_case *);
      void register_test_unit(test_suite *);
      void deregister_test_unit(test_unit *);

      // After this call the framework can be reinitialized to perform a second test run during the same program lifetime. 
      void clear();
      void register_observer(test_observer &);
      void deregister_observer(test_observer &);
      void register_global_fixture(test_unit_fixture &);
      void deregister_global_fixture(test_unit_fixture &);
      int add_context(lazy_ostream const &, bool);
      void clear_context(int = -1);

      // Produces an instance of small "delegate" object, which facilitates access to collected context. 
      context_generator get_context();
      master_test_suite_t & master_test_suite();
      test_unit const & current_test_unit();
      test_case const & current_test_case();
      test_unit_id current_test_case_id();
      test_unit & get(test_unit_id, test_unit_type);
      template<typename UnitType> UnitType & get(test_unit_id);
      void run(test_unit_id = INV_TEST_UNIT_ID, bool = true);

      // Initiates test execution. Same as other overload. 
      void run(test_unit const * tu, bool continue_test = true);
      void assertion_result(unit_test::assertion_result ar);

      // Reports uncaught exception to all test observers. 
      void exception_caught(execution_exception const &);

      // Reports aborted test unit to all test observers. 
      void test_unit_aborted(test_unit const &);

      // Reports aborted test module to all test observers. 
      void test_aborted();
      namespace impl {
        void setup_for_execution(test_unit const &);
        void setup_loggers();
      }
    }
  }
}

PrevUpHomeNext