SimpleString MockNamedValue::toString() const { if (type_ == "bool") return StringFrom(value_.boolValue_); else if (type_ == "int") return StringFrom(value_.intValue_) + " " + BracketsFormattedHexStringFrom(value_.intValue_); else if (type_ == "unsigned int") return StringFrom(value_.unsignedIntValue_) + " " + BracketsFormattedHexStringFrom(value_.unsignedIntValue_); else if (type_ == "long int") return StringFrom(value_.longIntValue_) + " " + BracketsFormattedHexStringFrom(value_.longIntValue_); else if (type_ == "unsigned long int") return StringFrom(value_.unsignedLongIntValue_) + " " + BracketsFormattedHexStringFrom(value_.unsignedLongIntValue_); else if (type_ == "const char*") return value_.stringValue_; else if (type_ == "void*") return StringFrom(value_.pointerValue_); else if (type_ == "void (*)()") return StringFrom(value_.functionPointerValue_); else if (type_ == "const void*") return StringFrom(value_.constPointerValue_); else if (type_ == "double") return StringFrom(value_.doubleValue_); else if (type_ == "const unsigned char*") return StringFromBinaryWithSizeOrNull(value_.memoryBufferValue_, size_); if (comparator_) return comparator_->valueToString(value_.objectPointerValue_); return StringFromFormat("No comparator found for type: \"%s\"", type_.asCharString()); }
SignedBytesEqualFailure::SignedBytesEqualFailure (UtestShell* test, const char* fileName, int lineNumber, signed char expected, signed char actual, const SimpleString& text) : TestFailure(test, fileName, lineNumber) { message_ = createUserText(text); SimpleString aDecimal = StringFrom((int)actual); SimpleString eDecimal = StringFrom((int)expected); SimpleString::padStringsToSameLength(aDecimal, eDecimal, ' '); SimpleString actualReported = aDecimal + " " + BracketsFormattedHexStringFrom(actual); SimpleString expectedReported = eDecimal + " " + BracketsFormattedHexStringFrom(expected); message_ += createButWasString(expectedReported, actualReported); }
MockActualCall& MockActualCallTrace::withLongIntParameter(const SimpleString& name, long int value) { addParameterName(name); traceBuffer_ += StringFrom(value) + " " + BracketsFormattedHexStringFrom(value); return *this; }