Пример #1
0
 void assertion_failed(char const * expr,
                       char const * function,
                       char const * file,
                       long line)
 {
     class assert_exception : public std::exception
     {
         public:
             assert_exception(std::string const & message) throw () :
                 m_message(message)
             {
             }
             virtual ~assert_exception() throw ()
             {
             }
             virtual char const * what() const throw ()
             {
                 return m_message.c_str();
             }
         private:
             std::string m_message;
     };
     std::ostringstream stream;
     stream << file << ":" << line <<
         " (" << function << ") failure: " << expr;
     throw assert_exception(stream.str());
 }
Пример #2
0
void assertion_failed(char const* expr, 
                      char const* /*function*/, 
                      char const* /*file*/, 
                      long /*line*/)
{
    throw assert_exception(expr);
}
Пример #3
0
int main()
{
	assert_exception(jfcpp::circular_buffer<int>(0), ContractViolated);

	{
		jfcpp::circular_buffer<int> buf(1);


		assert(buf.capacity() == 1);

		assert(buf.size() == 0);

		assert(buf.empty());

		assert(!buf.full());

		assert(buf.begin() == buf.end());

		assert_exception(buf[0], ContractViolated);

		assert_exception(buf.at(0), std::out_of_range);


		buf.push_back(10);

		assert(buf.size() == 1);

		assert(!buf.empty());

		assert(buf.full());

		assert(buf.begin() != buf.end());

		assert(*(buf.begin()) == 10);

		assert(buf[0] == 10);

		assert(buf.at(0) == 10);
	}
}
Пример #4
0
void BattleRoomTab::UpdateMapInfoSummary()
{
	try // updates map info summary
	{
		//ASSERT_EXCEPTION( m_battle->MapExists(false), _T( "Map does not exist." ) );
		if (m_battle->MapExists(false) == false)
			throw assert_exception(0);
		LSL::UnitsyncMap map = m_battle->LoadMap();
		m_opts_list->SetItem(m_opt_list_map[_("Size")], 1, wxString::Format(_T( "%.0fx%.0f" ), map.info.width / 512.0, map.info.height / 512.0));
		m_opts_list->SetItem(m_opt_list_map[_("Windspeed")], 1, wxString::Format(_T( "%d-%d" ), map.info.minWind, map.info.maxWind));
		m_opts_list->SetItem(m_opt_list_map[_("Tidal strength")], 1, wxString::Format(_T( "%d" ), map.info.tidalStrength));
		//    m_opts_list->SetItem( 0, 1,  );
	} catch (...) {
		m_opts_list->SetItem(m_opt_list_map[_("Size")], 1, _T( "?x?" ));
		m_opts_list->SetItem(m_opt_list_map[_("Windspeed")], 1, _T( "?-?" ));
		m_opts_list->SetItem(m_opt_list_map[_("Tidal strength")], 1, _T( "?" ));
	}
}