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; }
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); } } }