• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ASSERT_MESSAGE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ASSERT_MESSAGE函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_MESSAGE函数的具体用法?C++ ASSERT_MESSAGE怎么用?C++ ASSERT_MESSAGE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ASSERT_MESSAGE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ASSERT_MESSAGE

void FaceInstance::update_move_planepts_vertex2(std::size_t index, std::size_t other)
{
	ASSERT_MESSAGE(index < m_face->getWinding().size(), "select_vertex: invalid index");

	const std::size_t opposite = m_face->getWinding().opposite(index, other);

	if (triangle_reversed(index, other, opposite)) {
		std::swap(index, other);
	}

	ASSERT_MESSAGE(
		triangles_same_winding(
			m_face->getWinding()[opposite].vertex,
			m_face->getWinding()[index].vertex,
			m_face->getWinding()[other].vertex,
			m_face->getWinding()[0].vertex,
			m_face->getWinding()[1].vertex,
			m_face->getWinding()[2].vertex
		),
		"update_move_planepts_vertex2: error"
	)

	m_face->m_move_planepts[0] = m_face->getWinding()[opposite].vertex;
	m_face->m_move_planepts[1] = m_face->getWinding()[index].vertex;
	m_face->m_move_planepts[2] = m_face->getWinding()[other].vertex;
	planepts_quantise(m_face->m_move_planepts, GRID_MIN); // winding points are very inaccurate
}
开发者ID:OpenTechEngine,项目名称:DarkRadiant,代码行数:27,代码来源:FaceInstance.cpp


示例2: Buttons_release

bool Buttons_release(ButtonMask& buttons, guint button, guint state)
{
  if(buttons != 0 && bitfield_disable(buttons, ButtonMask_for_event_button(button)) == 0)
  {
    ASSERT_MESSAGE(!g_accel_enabled, "Buttons_release: accelerators are enabled");
    g_accel_enabled = true;
    for(WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i)
    {
      GtkWindow* toplevel = *i;
      ASSERT_MESSAGE(!window_has_accel(toplevel), "ERROR");
      ASSERT_MESSAGE(GTK_WIDGET_TOPLEVEL(toplevel), "enabling accel for non-toplevel window");
      gtk_window_add_accel_group(toplevel, global_accel);
#if 0
      globalOutputStream() << reinterpret_cast<unsigned int>(toplevel) << ": enabled global accelerators\n";
#endif
#if 0
      accel_group_test(toplevel, global_accel);
#endif
    }
    GlobalQueuedAccelerators_commit();
  }
  buttons = bitfield_disable(buttons, ButtonMask_for_event_button(button));
#if 0
  globalOutputStream() << "Buttons_release: ";
  print_buttons(buttons);
#endif
  return false;
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:28,代码来源:accelerator.cpp


示例3: Buttons_press

bool Buttons_press(ButtonMask& buttons, guint button, guint state)
{
  if(buttons == 0 && bitfield_enable(buttons, ButtonMask_for_event_button(button)) != 0)
  {
    ASSERT_MESSAGE(g_accel_enabled, "Buttons_press: accelerators not enabled");
    g_accel_enabled = false;
    for(WindowSet::iterator i = g_accel_windows.begin(); i != g_accel_windows.end(); ++i)
    {
      GtkWindow* toplevel = *i;
      ASSERT_MESSAGE(window_has_accel(toplevel), "ERROR");
      ASSERT_MESSAGE(GTK_WIDGET_TOPLEVEL(toplevel), "disabling accel for non-toplevel window");
      gtk_window_remove_accel_group(toplevel,  global_accel);
#if 0
      globalOutputStream() << reinterpret_cast<unsigned int>(toplevel) << ": disabled global accelerators\n";
#endif
#if 0
      accel_group_test(toplevel, global_accel);
#endif
    }
  }
  buttons = bitfield_enable(buttons, ButtonMask_for_event_button(button));
#if 0
  globalOutputStream() << "Buttons_press: ";
  print_buttons(buttons);
#endif
  return false;
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:27,代码来源:accelerator.cpp


示例4: ASSERT_MESSAGE

void CCBinaryFile::setPosition(const uint pos)
{
	ASSERT_MESSAGE( m_File != NULL, "File::Position(...) : ERROR! File not open" );
	ASSERT_MESSAGE( pos < m_Size, "File::Position(...) : ERROR! Invalid file position" );

	fseek( m_File, pos, SEEK_SET );
	m_Position = pos;
}
开发者ID:Orange-OpenSource,项目名称:2c,代码行数:8,代码来源:CCDeviceFileManager.cpp


示例5: logMsg

void example_test_class::test_assert_message()
{
  logMsg("ASSERT_MESSAGE example");
  /*
   Wrapper of
  void assertTrue(const char * msg, bool expression
                , const char* file, int line);
   */
  ASSERT_MESSAGE(1 < 2, "ASSERT_MESSAGE example (true)");
  ASSERT_MESSAGE(1 > 2, "ASSERT_MESSAGE example (fail) - EXPECTED failure");
}
开发者ID:hossainmurad,项目名称:mycppcgi,代码行数:11,代码来源:example.cpp


示例6: ASSERT

bool Cx_CfgRecord::AddFieldValue(const std::wstring& wstrField, 
                                 const std::wstring& wstrValue)
{
    ASSERT(IsValid() && !wstrValue.empty());
    ASSERT_MESSAGE(DbFunc::IsDBName(wstrField.c_str()), "Invalid field name.");
    ASSERT_MESSAGE(!HasFieldValue(wstrField), "The field has already set value.");

    m_arrValue.push_back(FieldValue(wstrField, wstrValue));

    return true;
}
开发者ID:killvxk,项目名称:WebbrowserLock,代码行数:11,代码来源:Cx_CfgRecord.cpp


示例7: seteuid

void ApplicationContextImpl::initialise(int argc, char* argv[]) {
	// Give away unnecessary root privileges.
	// Important: must be done before calling gtk_init().
	char *loginname;
	struct passwd *pw;
	seteuid(getuid());

	if (geteuid() == 0 &&
		(loginname = getlogin()) != 0 &&
		(pw = getpwnam(loginname)) != 0)
	{
		setuid(pw->pw_uid);
	}

	initArgs(argc, argv);

    // Initialise the home directory path
    std::string home = os::standardPathWithSlash(g_get_home_dir()) + ".darkradiant/";
    os::makeDirectory(home);
    _homePath = home;

	{
		char real[PATH_MAX];
		_appPath = getexename(real, argv);
		ASSERT_MESSAGE(!_appPath.empty(), "failed to deduce app path");
	}

	// Initialise the relative paths
	initPaths();
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:30,代码来源:ApplicationContextImpl.cpp


示例8: ASSERT_MESSAGE

void Dialog::Destroy()
{
  ASSERT_MESSAGE(m_window != 0, "dialog cannot be destroyed");

  gtk_widget_destroy(GTK_WIDGET(m_window));
  m_window = 0;
}
开发者ID:clbr,项目名称:netradiant,代码行数:7,代码来源:dialog.cpp


示例9: unrealise

 ~ModelResource ()
 {
     if (realised()) {
         unrealise();
     }
     ASSERT_MESSAGE(!realised(), "ModelResource::~ModelResource: resource reference still realised: " << m_name);
 }
开发者ID:kevlund,项目名称:ufoai,代码行数:7,代码来源:referencecache.cpp


示例10: Winding_Opposite

std::size_t Winding_Opposite(const Winding& winding, const std::size_t index, const std::size_t other)
{
  ASSERT_MESSAGE(index < winding.numpoints && other < winding.numpoints, "Winding_Opposite: index out of range");

  double dist_best = 0;
  std::size_t index_best = c_brush_maxFaces;

  Ray edge(ray_for_points(winding[index].vertex, winding[other].vertex));

  for(std::size_t i=0; i<winding.numpoints; ++i)
  {
    if(i == index || i == other)
    {
      continue;
    }

    double dist_squared = ray_squared_distance_to_point(edge, winding[i].vertex);

    if(dist_squared > dist_best)
    {
      dist_best = dist_squared;
      index_best = i;
    }
  }
  return index_best;
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:26,代码来源:winding.cpp


示例11: ASSERT_MESSAGE

void CCJNI::BillingRequestPurchase(const char *productID, CCLambdaCallback *callback)
{
	if( billingCallback != NULL )
	{
		delete billingCallback;
	}
	billingCallback = callback;

	CCText androidProductID = productID;
	androidProductID.toLowercase();

	// JNI Java call
	JNIEnv *jEnv = gView->jniEnv;

	jclass jniClass = jEnv->FindClass( "com/android2c/CCJNI" );
	ASSERT_MESSAGE( jniClass != 0, "Could not find Java class." );

	// Get the method ID of our method "startVideoView", which takes one parameter of type string, and returns void
	static jmethodID mid = jEnv->GetStaticMethodID( jniClass, "BillingRequestPurchase", "(Ljava/lang/String;)V" );
	ASSERT( mid != 0 );

	// Call the function
	jstring javaURL = jEnv->NewStringUTF( androidProductID.buffer );
	jEnv->CallStaticVoidMethod( jniClass, mid, javaURL );
	//jEnv->DeleteLocalRef( javaURL );
}
开发者ID:Geek365,项目名称:PhoneWarsDemo,代码行数:26,代码来源:CCJNI.cpp


示例12: mergeSelectedBrushes

void mergeSelectedBrushes(const cmd::ArgumentList& args)
{
	// Get the current selection
	BrushPtrVector brushes = selection::algorithm::getSelectedBrushes();

	if (brushes.empty()) {
		rMessage() << _("CSG Merge: No brushes selected.") << std::endl;
		wxutil::Messagebox::ShowError(_("CSG Merge: No brushes selected."));
		return;
	}

	if (brushes.size() < 2) {
		rMessage() << "CSG Merge: At least two brushes have to be selected.\n";
		wxutil::Messagebox::ShowError("CSG Merge: At least two brushes have to be selected.");
		return;
	}

	rMessage() << "CSG Merge: Merging " << brushes.size() << " brushes." << std::endl;

	UndoableCommand undo("mergeSelectedBrushes");

	// Take the last selected node as reference for layers and parent
	scene::INodePtr merged = GlobalSelectionSystem().ultimateSelected();

	scene::INodePtr parent = merged->getParent();
	assert(parent != NULL);

	// Create a new BrushNode
	scene::INodePtr node = GlobalBrushCreator().createBrush();

	// Insert the newly created brush into the (same) parent entity
	parent->addChildNode(node);

	// Move the new brush to the same layers as the merged one
	node->assignToLayers(merged->getLayers());

	// Get the contained brush
	Brush* brush = Node_getBrush(node);

	// Attempt to merge the selected brushes into the new one
	if (!Brush_merge(*brush, brushes, true))
	{
		rWarning() << "CSG Merge: Failed - result would not be convex." << std::endl;
		return;
	}

	ASSERT_MESSAGE(!brush->empty(), "brush left with no faces after merge");

	// Remove the original brushes
	for (BrushPtrVector::iterator i = brushes.begin(); i != brushes.end(); ++i)
	{
		scene::removeNodeFromParent(*i);
	}

	// Select the new brush
	Node_setSelected(node, true);

	rMessage() << "CSG Merge: Succeeded." << std::endl;
	SceneChangeNotify();
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:60,代码来源:CSG.cpp


示例13: ASSERT_MESSAGE

void GroupDlg::Create(GtkWindow* parent)
{
  ASSERT_MESSAGE(m_window == 0, "dialog already created");

  GtkWindow* window = create_persistent_floating_window("Entities", parent);

  global_accel_connect_window(window);

  window_connect_focus_in_clear_focus_widget(window);

  m_window = window;

#ifdef WIN32
  if( g_multimon_globals.m_bStartOnPrimMon )
  {
    WindowPosition pos(m_position_tracker.getPosition());
    PositionWindowOnPrimaryScreen(pos);
    m_position_tracker.setPosition(pos);
  }
#endif
  m_position_tracker.connect(window);

  {
    GtkWidget* notebook = gtk_notebook_new();
    gtk_widget_show(notebook);
    gtk_container_add (GTK_CONTAINER (window), notebook);
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_BOTTOM);
    m_pNotebook = notebook;

    g_signal_connect(G_OBJECT(notebook), "switch_page", G_CALLBACK(switch_page), window);
  }
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:32,代码来源:groupdialog.cpp


示例14: ASSERT_MESSAGE

void Clipper::getPlanePoints(Vector3 planepts[3], const AABB& bounds) const {
	ASSERT_MESSAGE(valid(), "clipper points not initialised");

	planepts[0] = _clipPoints[0]._coords;
	planepts[1] = _clipPoints[1]._coords;
	planepts[2] = _clipPoints[2]._coords;

	Vector3 maxs(bounds.origin + bounds.extents);
	Vector3 mins(bounds.origin - bounds.extents);

	if (!_clipPoints[2].isSet()) {
		int n = (_viewType == XY) ? 2 : (_viewType == YZ) ? 0 : 1;
		int x = (n == 0) ? 1 : 0;
		int y = (n == 2) ? 1 : 2;

		if (n == 1) // on viewtype XZ, flip clip points
		{
			planepts[0][n] = maxs[n];
			planepts[1][n] = maxs[n];
			planepts[2][x] = _clipPoints[0]._coords[x];
			planepts[2][y] = _clipPoints[0]._coords[y];
			planepts[2][n] = mins[n];
		}
		else {
			planepts[0][n] = mins[n];
			planepts[1][n] = mins[n];
			planepts[2][x] = _clipPoints[0]._coords[x];
			planepts[2][y] = _clipPoints[0]._coords[y];
			planepts[2][n] = maxs[n];
		}
	}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:32,代码来源:Clipper.cpp


示例15: GetListInternal

static GSList* GetListInternal (const char *refdir, const char *ext, bool directories, std::size_t depth)
{
  GSList* files = 0;

  ASSERT_MESSAGE(refdir[strlen(refdir) - 1] == '/', "search path does not end in '/'");

  if(directories)
  {
    for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
    {
      DirectoryListVisitor visitor(files, refdir);
      (*i).archive->forEachFile(Archive::VisitorFunc(visitor, Archive::eDirectories, depth), refdir);
    }
  }
  else
  {
    for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
    {
      FileListVisitor visitor(files, refdir, ext);
      (*i).archive->forEachFile(Archive::VisitorFunc(visitor, Archive::eFiles, depth), refdir);
    }
  }

  files = g_slist_reverse(files);

  return files;
}
开发者ID:clbr,项目名称:netradiant,代码行数:27,代码来源:vfs.cpp


示例16: _sigSelectionChanged

// greebo: This should be called "onComponentSelectionChanged", as it is a similar function of the above one
// Updates the internal list of component nodes if the component selection gets changed
void RadiantSelectionSystem::onComponentSelection(const scene::INodePtr& node, const Selectable& selectable) {

    int delta = selectable.isSelected() ? +1 : -1;

    _countComponent += delta;
    _sigSelectionChanged(selectable);

    _selectionInfo.totalCount += delta;
    _selectionInfo.componentCount += delta;

    // If the instance got selected, add it to the list, otherwise remove it
    if (selectable.isSelected()) {
        _componentSelection.append(node);
    }
    else {
        _componentSelection.erase(node);
    }

    // Notify observers, TRUE => this is a component selection change
    notifyObservers(node, true);

    // Check if the number of selected components in the list matches the value of the selection counter
    ASSERT_MESSAGE(_componentSelection.size() == _countComponent, "component selection-tracking error");

    // Schedule an idle callback
    requestIdleCallback();

    _requestWorkZoneRecalculation = true;
    _requestSceneGraphChange = true;
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:32,代码来源:RadiantSelectionSystem.cpp


示例17: ASSERT_MESSAGE

 const detail::DeviceBuffer&
 Vector<Index>::deviceBuffer(const detail::Device& /*device*/) const
 {
   ASSERT_MESSAGE(false, "This function should never be called!");
   static detail::DeviceBuffer db;
   return db;
 }
开发者ID:skelcl,项目名称:skelcl,代码行数:7,代码来源:IndexVector.cpp


示例18: ASSERT_MESSAGE

std::size_t Winding::opposite(const std::size_t index, const std::size_t other) const
{
	ASSERT_MESSAGE(index < size() && other < size(), "Winding::opposite: index out of range");

	float dist_best = 0;
	std::size_t index_best = c_brush_maxFaces;

	Ray edge = Ray::createForPoints((*this)[index].vertex, (*this)[other].vertex);

	for (std::size_t i=0; i < size(); ++i)
	{
		if (i == index || i == other) {
			continue;
		}

		float dist_squared = edge.getSquaredDistance((*this)[i].vertex);

		if (dist_squared > dist_best) {
			dist_best = dist_squared;
			index_best = i;
		}
	}

	return index_best;
}
开发者ID:BielBdeLuna,项目名称:DarkRadiant,代码行数:25,代码来源:Winding.cpp


示例19: _selectionChangedCallbacks

// This is called if the selection changes, so that the local list of selected instances can be updated
void RadiantSelectionSystem::onSelectedChanged(scene::Instance& instance, const Selectable& selectable) {
	// Cache the selection state
	bool isSelected = selectable.isSelected();

	_countPrimitive += (isSelected) ? +1 : -1;
	_selectionChangedCallbacks(selectable); // legacy

	_selectionInfo.totalCount += (isSelected) ? +1 : -1;

	if (Instance_getBrush(instance) != NULL) {
		_selectionInfo.brushCount += (isSelected) ? +1 : -1;
	}
	else {
		_selectionInfo.entityCount += (isSelected) ? +1 : -1;
	}

	// If the selectable is selected, add it to the local selection list, otherwise remove it
	if (isSelected) {
		_selection.append(instance);
	}
	else {
		_selection.erase(instance);
	}

	// Notify observers, FALSE = primitive selection change
	notifyObservers(instance, false);

	// Check if the number of selected primitives in the list matches the value of the selection counter
	ASSERT_MESSAGE(_selection.size() == _countPrimitive, "selection-tracking error");

	// Schedule an idle callback
	requestIdleCallback();

	_requestWorkZoneRecalculation = true;
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:36,代码来源:RadiantSelectionSystem.cpp


示例20: ASSERT_MESSAGE

bool Cx_CfgRecord::GetDateTime(const wchar_t* pszEntry, int& year, int& month, int& day, 
                                  int& hour, int& minute, int& second)
{
    ASSERT_MESSAGE(m_pRs != NULL, "The record is write-only.");

    if (m_pRs != NULL)
    {
        try
        {
            _variant_t var(m_pRs->GetFields()->GetItem(pszEntry)->GetValue());
            COleDateTime dt;

            if (DbFunc::GetDateTime(dt, var))
            {
                year = dt.GetYear();
                month = dt.GetMonth();
                day = dt.GetDay();
                hour = dt.GetHour();
                minute = dt.GetMinute();
                second = dt.GetSecond();

                return true;
            }
        }
        CATCH_DB_STR_ERROR
    }

    return false;
}
开发者ID:killvxk,项目名称:WebbrowserLock,代码行数:29,代码来源:Cx_CfgRecord.cpp



注:本文中的ASSERT_MESSAGE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERT_MSG函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERT_MAIN_THREAD函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap