示例#1
0
void FailableMemoryAllocator::failIfMaximumNumberOfFailedAllocsExceeded(int toFailCount)
{
    UtestShell* currentTest = UtestShell::getCurrent();

    if (toFailCount >= MAX_NUMBER_OF_FAILED_ALLOCS)
        currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(),
            currentTest->getLineNumber(), "Maximum number of failed memory allocations exceeded"),
            TestTerminatorWithoutExceptions());
}
示例#2
0
void FailableMemoryAllocator::failIfUndoneFailedAllocs()
{
    for (int i = 0; i < toFailCount_; i++) {
        if (allocsToFail_[i] != FAILED_ALLOC_DONE) {
            UtestShell* currentTest = UtestShell::getCurrent();
            SimpleString failText = StringFromFormat("Expected allocation number %d was never done", allocsToFail_[i]);
            currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(),
                    currentTest->getLineNumber(), failText), TestTerminatorWithoutExceptions());
        }
    }
}
示例#3
0
void FailableMemoryAllocator::failIfUndoneFailedLocationAllocs()
{
    for (int i = 0; i < locationToFailCount_; i++) {
        if (!locationAllocsToFail_[i].done) {
            UtestShell* currentTest = UtestShell::getCurrent();
            SimpleString failText = StringFromFormat("Expected failing alloc at %s:%d was never done",
                    locationAllocsToFail_[i].file,
                    locationAllocsToFail_[i].line);
            currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(),
                    currentTest->getLineNumber(), failText), TestTerminatorWithoutExceptions());
        }
    }
}
示例#4
0
void FailableMemoryAllocator::checkAllFailedAllocsWereDone()
{
  if (head_) {
    UtestShell* currentTest = UtestShell::getCurrent();
    SimpleString failText;
    if (head_->file_)
      failText = StringFromFormat("Expected failing alloc at %s:%d was never done", head_->file_, head_->line_);
    else
      failText = StringFromFormat("Expected allocation number %d was never done", head_->allocNumberToFail_);

    currentTest->failWith(FailFailure(currentTest, currentTest->getName().asCharString(),
    currentTest->getLineNumber(), failText), TestTerminatorWithoutExceptions());
  }
}
示例#5
0
void UtestShell::fail(const char *text, const char* fileName, int lineNumber, const TestTerminator& testTerminator)
{
    getTestResult()->countCheck();
    failWith(FailFailure(this, fileName, lineNumber, text), testTerminator);
} // LCOV_EXCL_LINE
示例#6
0
void UtestShell::fail(const char *text, const char* fileName, int lineNumber)
{
	failWith(FailFailure(this, fileName, lineNumber, text));
}
	virtual void fail(char* fail_string)
	{
		UtestShell* currentTest = UtestShell::getCurrent();
		currentTest->getTestResult()->addFailure(FailFailure(currentTest, currentTest->getName().asCharString(), currentTest->getLineNumber(), fail_string));
		currentTest->exitCurrentTestWithoutException();
	}