当前位置: 首页>>代码示例>>C++>>正文


C++ MockNamedValue::getType方法代码示例

本文整理汇总了C++中MockNamedValue::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ MockNamedValue::getType方法的具体用法?C++ MockNamedValue::getType怎么用?C++ MockNamedValue::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MockNamedValue的用法示例。


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

示例1: MockFailure

MockUnexpectedOutputParameterFailure::MockUnexpectedOutputParameterFailure(UtestShell* test, const SimpleString& functionName, const MockNamedValue& parameter, const MockExpectedCallsList& expectations)  : MockFailure(test)
{
    MockExpectedCallsList expectationsForFunctionWithParameterName;
    expectationsForFunctionWithParameterName.addExpectationsRelatedTo(functionName, expectations);
    expectationsForFunctionWithParameterName.onlyKeepExpectationsWithOutputParameterName(parameter.getName());

    if (expectationsForFunctionWithParameterName.isEmpty()) {
        message_ = "Mock Failure: Unexpected output parameter name to function \"";
        message_ += functionName;
        message_ += "\": ";
        message_ += parameter.getName();
    }
    else {
        message_ = "Mock Failure: Unexpected parameter type \"";
        message_ += parameter.getType();
        message_ += "\" to output parameter \"";
        message_ += parameter.getName();
        message_ += "\" to function \"";
        message_ += functionName;
        message_ += "\"";
    }

    message_ += "\n";
    addExpectationsAndCallHistoryRelatedTo(functionName, expectations);

    message_ += "\n\tACTUAL unexpected output parameter passed to function: ";
    message_ += functionName;
    message_ += "\n";

    message_ += "\t\t";
    message_ += parameter.getType();
    message_ += " ";
    message_ += parameter.getName();
}
开发者ID:Andne,项目名称:cpputest,代码行数:34,代码来源:MockFailure.cpp

示例2: getMockValueCFromNamedValue

static MockValue_c getMockValueCFromNamedValue(const MockNamedValue& namedValue)
{
	MockValue_c returnValue;
	if (strcmp(namedValue.getType().asCharString(), "int") == 0) {
		returnValue.type = MOCKVALUETYPE_INTEGER;
		returnValue.value.intValue = namedValue.getIntValue();
	}
	else if (strcmp(namedValue.getType().asCharString(), "double") == 0) {
		returnValue.type = MOCKVALUETYPE_DOUBLE;
		returnValue.value.doubleValue = namedValue.getDoubleValue();
	}
	else if (strcmp(namedValue.getType().asCharString(), "char*") == 0) {
		returnValue.type = MOCKVALUETYPE_STRING;
		returnValue.value.stringValue = namedValue.getStringValue();
	}
	else if (strcmp(namedValue.getType().asCharString(), "void*") == 0) {
		returnValue.type = MOCKVALUETYPE_POINTER;
		returnValue.value.pointerValue = namedValue.getPointerValue();
	}
	else {
		returnValue.type = MOCKVALUETYPE_OBJECT;
		returnValue.value.objectValue = namedValue.getObjectPointer();
	}
	return returnValue;
}
开发者ID:CNCBASHER,项目名称:mri,代码行数:25,代码来源:MockSupport_c.cpp

示例3: finalizeOutputParameters

void MockCheckedActualCall::finalizeOutputParameters(MockCheckedExpectedCall* expectedCall)
{
    for (MockOutputParametersListNode* p = outputParameterExpectations_; p; p = p->next_)
    {
        MockNamedValue outputParameter = expectedCall->getOutputParameter(p->name_);
        MockNamedValueCopier* copier = outputParameter.getCopier();
        if (copier)
        {
            copier->copy(p->ptr_, outputParameter.getObjectPointer());
        }
        else if ((outputParameter.getType() == "const void*") && (p->type_ == "void*"))
        {
            const void* data = outputParameter.getConstPointerValue();
            size_t size = outputParameter.getSize();
            PlatformSpecificMemCpy(p->ptr_, data, size);
        }
        else if (outputParameter.getName() != "")
        {
            SimpleString type = expectedCall->getOutputParameter(p->name_).getType();
            MockNoWayToCopyCustomTypeFailure failure(getTest(), type);
            failTest(failure);
        }
    }
}
开发者ID:rhertzog,项目名称:cpputest,代码行数:24,代码来源:MockActualCall.cpp

示例4: getParameterType

SimpleString MockExpectedFunctionCall::getParameterType(const SimpleString& name)
{
	MockNamedValue * p = parameters_->getValueByName(name);
	return (p) ? p->getType() : "";
}
开发者ID:CNCBASHER,项目名称:mri,代码行数:5,代码来源:MockExpectedFunctionCall.cpp

示例5: getInputParameterType

SimpleString MockCheckedExpectedCall::getInputParameterType(const SimpleString& name)
{
    MockNamedValue * p = inputParameters_->getValueByName(name);
    return (p) ? p->getType() : "";
}
开发者ID:cpputest,项目名称:cpputest,代码行数:5,代码来源:MockExpectedCall.cpp


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