void TestRegistry::listTestGroupAndCaseNames(TestResult& result)
{
    SimpleString groupAndNameList;

    for (UtestShell *test = tests_; test != NULL; test = test->getNext()) {
        if (testShouldRun(test, result)) {
            SimpleString groupAndName;
            groupAndName += "#";
            groupAndName += test->getGroup();
            groupAndName += ".";
            groupAndName += test->getName();
            groupAndName += "#";

            if (!groupAndNameList.contains(groupAndName)) {
                groupAndNameList += groupAndName;
                groupAndNameList += " ";
            }
        }
    }

    groupAndNameList.replace("#", "");

    if (groupAndNameList.endsWith(" "))
        groupAndNameList = groupAndNameList.subString(0, groupAndNameList.size() - 1);
    result.print(groupAndNameList.asCharString());
}
Example #2
0
SimpleString HexStringFrom(signed char value)
{
    SimpleString result = StringFromFormat("%x", value);
    if(value < 0) {
        size_t size = result.size();
        result = result.subString(size-(CPPUTEST_CHAR_BIT/4));
    }
    return result;
}
Example #3
0
SimpleString StringFromBinary(const unsigned char* value, size_t size)
{
    SimpleString result;

    for (size_t i = 0; i < size; i++) {
        result += StringFromFormat("%02X ", value[i]);
    }
    result = result.subString(0, result.size() - 1);

    return result;
}
Example #4
0
SimpleString TestFailure::createDifferenceAtPosString(const SimpleString& actual, size_t position)
{
	SimpleString result;
	const size_t extraCharactersWindow = 20;
	const size_t halfOfExtraCharactersWindow = extraCharactersWindow / 2;

	SimpleString paddingForPreventingOutOfBounds (" ", halfOfExtraCharactersWindow);
	SimpleString actualString = paddingForPreventingOutOfBounds + actual + paddingForPreventingOutOfBounds;
	SimpleString differentString = StringFromFormat("difference starts at position %lu at: <", (unsigned long) position);

	result += "\n";
	result += StringFromFormat("\t%s%s>\n", differentString.asCharString(), actualString.subString(position, extraCharactersWindow).asCharString());

	SimpleString markString = actualString.subString(position, halfOfExtraCharactersWindow+1);
	markString = removeAllPrintableCharactersFrom(markString);
	markString = addMarkerToString(markString, halfOfExtraCharactersWindow);

	result += StringFromFormat("\t%s%s", SimpleString(" ", differentString.size()).asCharString(), markString.asCharString());
	return result;
}