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


C++ SimpleString::asCharString方法代码示例

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


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

示例1: getDeallocationString

SimpleString CodeMemoryReportFormatter::getDeallocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, const char* file, int line)
{
	if (isNewAllocator(allocator))
		return StringFromFormat("delete [] %s; /* using %s at %s:%d */", variableName.asCharString(), allocator->free_name(), file, line);
	else
		return StringFromFormat("free(%s); /* at %s:%d */", variableName.asCharString(), file, line);
}
开发者ID:UlkUpp,项目名称:cpputest,代码行数:7,代码来源:CodeMemoryReportFormatter.cpp

示例2: testName

Failure::Failure (const SimpleString&	theTestName, 
			 	  const SimpleString&	theFileName, 
				  long					theLineNumber,
				  const SimpleString&	expected,
				  const SimpleString&	actual) 
: testName (theTestName), 
  fileName (theFileName), 
  lineNumber (theLineNumber)
{
	char *part1 = "expected ";
	char *part3 = " but was: ";

	char *stage = new char [strlen (part1) 
					+ expected.size () 
					+ strlen (part3)
					+ actual.size ()
					+ 1];

	sprintf(stage, "%s%s%s%s", 
		part1, 
		expected.asCharString(), 
		part3, 
		actual.asCharString());

	message = SimpleString(stage);

	delete stage;
}
开发者ID:brindza,项目名称:phys-anim,代码行数:28,代码来源:Failure.cpp

示例3: getAllocationString

SimpleString CodeMemoryReportFormatter::getAllocationString(TestMemoryAllocator* allocator, const SimpleString& variableName, size_t size)
{
	if (isNewAllocator(allocator))
		return StringFromFormat("char* %s = new char[%d]; /* using %s */", variableName.asCharString(), size, allocator->alloc_name());
	else
		return StringFromFormat("void* %s = malloc(%d);", variableName.asCharString(), size);
}
开发者ID:UlkUpp,项目名称:cpputest,代码行数:7,代码来源:CodeMemoryReportFormatter.cpp

示例4: testName

Failure::Failure (const SimpleString&	theTestName, 
			 	  const SimpleString&	theFileName, 
				  long					theLineNumber,
				  const SimpleString&	expected,
				  const SimpleString&	actual) 
: testName (theTestName), 
  fileName (theFileName), 
  lineNumber (theLineNumber)
{
	TCHAR *part1 = TEXT("expected ");
	TCHAR *part3 = TEXT(" but was: ");

	//[guyu modify
	size_t buflen = _tcslen (part1) 
					+ expected.size () 
					+ _tcslen (part3)
					+ actual.size ()
					+ 1;
	TCHAR *stage = new TCHAR [buflen];

	_stprintf_s (stage, buflen, TEXT("%s%s%s%s"), 
		part1, 
		expected.asCharString(), 
		part3, 
		actual.asCharString());
	//]guyu

	message = SimpleString(stage);

	delete stage;
}
开发者ID:ccanan,项目名称:BladeMaster,代码行数:31,代码来源:Failure.cpp

示例5: TestFailure

CheckEqualFailure::CheckEqualFailure(UtestShell* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual) : TestFailure(test, fileName, lineNumber)
{
	size_t failStart;
	for (failStart = 0; actual.asCharString()[failStart] == expected.asCharString()[failStart]; failStart++)
		;
	message_ = createButWasString(expected, actual);
	message_ += createDifferenceAtPosString(actual, failStart);

}
开发者ID:dreadlock,项目名称:cpputest,代码行数:9,代码来源:TestFailure.cpp

示例6: writeToFile

void JUnitTestOutput::writeToFile(const SimpleString& buffer)
{
#if XML_TO_COM
  while(write(OutputFileDesc, buffer.asCharString(), strlen(buffer.asCharString())) != 0){
    (void) rtems_task_wake_after( 1 );
  }

#else
    PlatformSpecificFPuts(buffer.asCharString(), impl_->file_);
#endif
}
开发者ID:jaymdoyle,项目名称:unit_test_2,代码行数:11,代码来源:JUnitTestOutput.cpp

示例7: writeFailure

void JUnitTestOutput::writeFailure(JUnitTestCaseResultNode* node)
{
	SimpleString message = node->failure_->getMessage().asCharString();
	message.replace('"', '\'');
	message.replace('<', '[');
	message.replace('>', ']');
	message.replace("\n", "{newline}");
	SimpleString buf = StringFromFormat(
			"<failure message=\"%s:%d: %s\" type=\"AssertionFailedError\">\n",
			node->failure_->getFileName().asCharString(),
			node->failure_->getFailureLineNumber(), message.asCharString());
	writeToFile(buf.asCharString());
	writeToFile("</failure>\n");
}
开发者ID:Pindar,项目名称:common-data-structures-in-c,代码行数:14,代码来源:JUnitTestOutput.cpp

示例8: writeTestCases

void JUnitTestOutput::writeTestCases()
{
    JUnitTestCaseResultNode* cur = impl_->results_.head_;

    while (cur) {
        SimpleString buf = StringFromFormat(
                "<testcase classname=\"%s%s%s\" name=\"%s\" assertions=\"%d\" time=\"%d.%03d\" file=\"%s\" line=\"%d\">\n",
                impl_->package_.asCharString(),
                impl_->package_.isEmpty() == true ? "" : ".",
                impl_->results_.group_.asCharString(),
                cur->name_.asCharString(),
                cur->checkCount_ - impl_->results_.totalCheckCount_,
                (int) (cur->execTime_ / 1000), (int)(cur->execTime_ % 1000),
                cur->file_.asCharString(),
                cur->lineNumber_);
        writeToFile(buf.asCharString());

        impl_->results_.totalCheckCount_ = cur->checkCount_;

        if (cur->failure_) {
            writeFailure(cur);
        }
        else if (cur->ignored_) {
            writeToFile("<skipped />\n");
        }
        writeToFile("</testcase>\n");
        cur = cur->next_;
    }
}
开发者ID:offa,项目名称:cpputest,代码行数:29,代码来源:JUnitTestOutput.cpp

示例9: printFailureMessage

void TestOutput::printFailureMessage(SimpleString reason)
{
	print("\n");
	print("\t");
	print(reason.asCharString());
	print("\n\n");
}
开发者ID:HackLinux,项目名称:KernelModuleTDDExperiment,代码行数:7,代码来源:TestOutput.cpp

示例10: expected

TEST(SimpleString, _64BitAddressPrintsCorrectly)
{
    char* p = (char*) 0x0012345678901234;
    SimpleString expected("0x12345678901234");
    SimpleString actual = StringFrom((void*)p);
    STRCMP_EQUAL(expected.asCharString(), actual.asCharString());
}
开发者ID:terryyin,项目名称:cpputest,代码行数:7,代码来源:SimpleStringTest.cpp

示例11: TestFailure

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());
}
开发者ID:FelixAdrianL,项目名称:cpputest,代码行数:7,代码来源:TestFailure.cpp

示例12: listTestGroupAndCaseNames

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());
}
开发者ID:13coders,项目名称:cookiecutter-kata-cpputest,代码行数:26,代码来源:TestRegistry.cpp

示例13: printVistualStudioErrorInFileOnLine

void TestOutput::printVistualStudioErrorInFileOnLine(SimpleString file, int lineNumber)
{
    print("\n\r");
    print(file.asCharString());
    print("(");
    print(lineNumber);
    print("):");
    print(" error:");
}
开发者ID:jaymdoyle,项目名称:unit_test_2,代码行数:9,代码来源:TestOutput.cpp

示例14: strcat

SimpleString SimpleString::operator+ (const SimpleString& other)
{
	SimpleString newS;
	free(newS.buffer);
	newS.buffer = NEW_BUFFER(this->size()+other.size()+1);
	strcpy(newS.buffer,this->asCharString());
	newS.buffer= strcat(newS.buffer,other.asCharString());
	return newS;
}
开发者ID:bossiernesto,项目名称:Strongtalk,代码行数:9,代码来源:simplestring.cpp

示例15: printEclipseErrorInFileOnLine

void TestOutput::printEclipseErrorInFileOnLine(SimpleString file, int lineNumber)
{
	print("\n");
	print(file.asCharString());
	print(":");
	print(lineNumber);
	print(":");
	print(" error:");
}
开发者ID:HackLinux,项目名称:KernelModuleTDDExperiment,代码行数:9,代码来源:TestOutput.cpp


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