void WxTerminateMessage::OnAssert(
		const Properties &,
		const Result &result) const
	{
		// We only show this in the main thread, although we could use
		// wxMutexGuiEnter and wxMutexGuiLeave, because wxMutexGuiLeave
		// can take a long time after wxMessageBox.

		if (wxIsMainThread())
		{
			wxString msg = GetText();
			if (result.GetParameterList())
				msg += "\n"+RichBool::ToString(*result.GetParameterList());
			wxMessageBox(msg, "ModAssert");
		}
	}
Exemple #2
0
	void WxLog::OnAssert(const Properties &properties,
			const Result &assertionResult) const
	{
		const GroupList *groupList = properties.GetGroupList();

		wxString groups;
		for (size_t idx=0; idx<groupList->GetSize(); ++idx)
		{
			if (idx!=0)
				groups += ", ";
			groups += groupList->GetName(idx);
		}

		const ParameterList *parList = assertionResult.GetParameterList();
		const bool hasValues = (parList!=NULL) && (parList->GetFirst()!=NULL);
		
		wxString info = GetAllInfo(properties, assertionResult, *this, "\n  ");

		RichBool::SharedAnalysis analysis = assertionResult.GetAnalysis();

		const char *condition = properties.GetCondition();

		// start with newline, so that the context is shown on a new line
		// and double clicking it in an IDE brings up the line in the source code
		wxLogDebug(
			"\n%s\n"
			"%s%s%s\n"
			"analysis: %s\n"
			"parameters:\n%s"
			"%s: %s\n"
			"%s%s",
			
			RichBool::ToString(properties.GetContext()).c_str(),
			properties.GetCategory()->GetName(),
			condition ? (assertionResult.Succeeded() ? " succeeded: " : " failed: ") : " failed unconditionally",
			condition ? condition : "",
			analysis  ? RichBool::ToString(*analysis).c_str() : "no analysis",
			hasValues ? RichBool::ToString(*parList).c_str() : "  no parameters\n",
			groupList->GetSize()==0 ? "no groups" : "groups",
			groups.c_str(),
			RichBool::detail::is_empty(info) ? "" : "info:\n",
			RichBool::detail::is_empty(info) ? "" : ("  "+info+"\n").c_str()
		);
	}