本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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
}
示例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");
}
示例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_;
}
}
示例9: printFailureMessage
void TestOutput::printFailureMessage(SimpleString reason)
{
print("\n");
print("\t");
print(reason.asCharString());
print("\n\n");
}
示例10: expected
TEST(SimpleString, _64BitAddressPrintsCorrectly)
{
char* p = (char*) 0x0012345678901234;
SimpleString expected("0x12345678901234");
SimpleString actual = StringFrom((void*)p);
STRCMP_EQUAL(expected.asCharString(), actual.asCharString());
}
示例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());
}
示例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());
}
示例13: printVistualStudioErrorInFileOnLine
void TestOutput::printVistualStudioErrorInFileOnLine(SimpleString file, int lineNumber)
{
print("\n\r");
print(file.asCharString());
print("(");
print(lineNumber);
print("):");
print(" error:");
}
示例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;
}
示例15: printEclipseErrorInFileOnLine
void TestOutput::printEclipseErrorInFileOnLine(SimpleString file, int lineNumber)
{
print("\n");
print(file.asCharString());
print(":");
print(lineNumber);
print(":");
print(" error:");
}