finalize.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // (C) Copyright Gennadiy Rozental 2001.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // File : $RCSfile$
  8. //
  9. // Version : $Revision$
  10. //
  11. // Description : runtime parameters initialization final step
  12. // ***************************************************************************
  13. #ifndef BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP
  14. #define BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP
  15. // Boost.Test Runtime parameters
  16. #include <boost/test/utils/runtime/parameter.hpp>
  17. #include <boost/test/utils/runtime/argument.hpp>
  18. // Boost.Test
  19. #include <boost/test/utils/foreach.hpp>
  20. #include <boost/test/detail/suppress_warnings.hpp>
  21. namespace boost {
  22. namespace runtime {
  23. inline void
  24. finalize_arguments( parameters_store const& params, runtime::arguments_store& args )
  25. {
  26. BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) {
  27. basic_param_ptr param = v.second;
  28. if( !args.has( param->p_name ) ) {
  29. if( param->p_has_default_value )
  30. param->produce_default( args );
  31. if( !args.has( param->p_name ) ) {
  32. BOOST_TEST_I_ASSRT( param->p_optional,
  33. missing_req_arg( param->p_name ) << "Missing argument for required parameter " << param->p_name << "." );
  34. }
  35. }
  36. if( args.has( param->p_name ) && !!param->p_callback )
  37. param->p_callback( param->p_name );
  38. }
  39. }
  40. } // namespace runtime
  41. } // namespace boost
  42. #include <boost/test/detail/enable_warnings.hpp>
  43. #endif // BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP