コード例 #1
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
ContainsFailure::ContainsFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += StringFromFormat("actual <%s>\n\tdid not contain  <%s>", actual.asCharString(), expected.asCharString());
}
コード例 #2
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
EqualsFailure::EqualsFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text)
    : TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += createButWasString(expected, actual);
}
コード例 #3
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
BitsEqualFailure::BitsEqualFailure(UtestShell* test, const char* fileName, int lineNumber, unsigned long expected, unsigned long actual,
                                   unsigned long mask, size_t byteCount, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += createButWasString(StringFromMaskedBits(expected, mask, byteCount), StringFromMaskedBits(actual, mask, byteCount));
}
コード例 #4
0
ファイル: TestFailure.cpp プロジェクト: carlsondc/cpputest
FeatureUnsupportedFailure::FeatureUnsupportedFailure(UtestShell* test, const char* fileName, int lineNumber,
                                                     const SimpleString& featureName, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += StringFromFormat("The feature \"%s\" is not supported in this environment or with the feature set selected when building the library.", featureName.asCharString());;
}
コード例 #5
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
CheckFailure::CheckFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& checkString, const SimpleString& conditionString, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += checkString;
    message_ += "(";
    message_ += conditionString;
    message_ += ") failed";
}
コード例 #6
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
CheckEqualFailure::CheckEqualFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    size_t failStart;
    for (failStart = 0; actual.asCharString()[failStart] == expected.asCharString()[failStart]; failStart++)
        ;
    message_ += createButWasString(expected, actual);
    message_ += createDifferenceAtPosString(actual, failStart);

}
コード例 #7
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
DoublesEqualFailure::DoublesEqualFailure(UtestShell* test, const char* fileName, int lineNumber, double expected, double actual, double threshold, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += createButWasString(StringFrom(expected, 7), StringFrom(actual, 7));
    message_ += " threshold used was <";
    message_ += StringFrom(threshold, 7);
    message_ += ">";

    if (PlatformSpecificIsNan(expected) || PlatformSpecificIsNan(actual) || PlatformSpecificIsNan(threshold))
        message_ += "\n\tCannot make comparisons with Nan";
}
コード例 #8
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
StringEqualNoCaseFailure::StringEqualNoCaseFailure(UtestShell* test, const char* fileName, int lineNumber, const char* expected, const char* actual, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    message_ += createButWasString(StringFromOrNull(expected), StringFromOrNull(actual));
    if((expected) && (actual))
    {
        size_t failStart;
        for (failStart = 0; SimpleString::ToLower(actual[failStart]) == SimpleString::ToLower(expected[failStart]); failStart++)
            ;
        message_ += createDifferenceAtPosString(actual, failStart);
    }
}
コード例 #9
0
ファイル: TestFailure.cpp プロジェクト: carlsondc/cpputest
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);
}
コード例 #10
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
BinaryEqualFailure::BinaryEqualFailure(UtestShell* test, const char* fileName, int lineNumber, const unsigned char* expected,
                                       const unsigned char* actual, size_t size, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

	message_ += createButWasString(StringFromBinaryOrNull(expected, size), StringFromBinaryOrNull(actual, size));
	if ((expected) && (actual))
	{
		size_t failStart;
		for (failStart = 0; actual[failStart] == expected[failStart]; failStart++)
			;
		message_ += createDifferenceAtPosString(StringFromBinary(actual, size), failStart, DIFFERENCE_BINARY);
	}
}
コード例 #11
0
ファイル: TestFailure.cpp プロジェクト: FelixAdrianL/cpputest
UnsignedLongsEqualFailure::UnsignedLongsEqualFailure(UtestShell* test, const char* fileName, int lineNumber, unsigned long expected, unsigned long actual, const SimpleString& text)
: TestFailure(test, fileName, lineNumber)
{
    message_ = createUserText(text);

    SimpleString aDecimal = StringFrom(actual);
    SimpleString aHex = HexStringFrom(actual);
    SimpleString eDecimal = StringFrom(expected);
    SimpleString eHex = HexStringFrom(expected);

    SimpleString::padStringsToSameLength(aDecimal, eDecimal, ' ');
    SimpleString::padStringsToSameLength(aHex, eHex, '0');

    SimpleString actualReported = aDecimal + " 0x" + aHex;
    SimpleString expectedReported = eDecimal + " 0x" + eHex;
    message_ += createButWasString(expectedReported, actualReported);
}