Qt 4.8
Namespaces | Functions | Variables
qtestresult.cpp File Reference
#include "QtTest/private/qtestresult_p.h"
#include <QtCore/qglobal.h>
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/qtestdata.h"
#include "QtTest/qtestassert.h"
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Namespaces

 QTest
 The QTest namespace contains all the functions and declarations that are related to the QTestLib tool.
 

Functions

static bool checkStatement (bool statement, const char *msg, const char *file, int line)
 
static void clearExpectFail ()
 
static bool isExpectFailData (const char *dataIndex)
 

Variables

static const char * QTest::currentAppName = 0
 
static QTestDataQTest::currentGlobalTestData = 0
 
static QTestDataQTest::currentTestData = 0
 
static const char * QTest::currentTestFunc = 0
 
static const char * QTest::currentTestObjectName = 0
 
static bool QTest::dataFailed = false
 
static const char * QTest::expectFailComment = 0
 
static int QTest::expectFailMode = 0
 
static bool QTest::failed = false
 
static int QTest::fails = 0
 
static QTestResult::TestLocation QTest::location = QTestResult::NoWhere
 
static int QTest::passes = 0
 
static bool QTest::skipCurrentTest = false
 
static int QTest::skips = 0
 

Function Documentation

◆ checkStatement()

static bool checkStatement ( bool  statement,
const char *  msg,
const char *  file,
int  line 
)
static

Definition at line 213 of file qtestresult.cpp.

Referenced by QTestResult::compare(), and QTestResult::verify().

214 {
215  if (statement) {
216  if (QTest::expectFailMode) {
217  QTestLog::addXPass(msg, file, line);
218  bool doContinue = (QTest::expectFailMode == QTest::Continue);
219  clearExpectFail();
220  QTest::failed = true;
221  ++QTest::fails;
222  return doContinue;
223  }
224  return true;
225  }
226 
227  if (QTest::expectFailMode) {
229  bool doContinue = (QTest::expectFailMode == QTest::Continue);
230  clearExpectFail();
231  return doContinue;
232  }
233 
234  QTestResult::addFailure(msg, file, line);
235  return false;
236 }
static void addFailure(const char *message, const char *file, int line)
static int expectFailMode
Definition: qtestresult.cpp:70
static void clearExpectFail()
static int fails
Definition: qtestresult.cpp:65
static bool failed
Definition: qtestresult.cpp:60
static void addXFail(const char *msg, const char *file, int line)
Definition: qtestlog.cpp:271
static const char * expectFailComment
Definition: qtestresult.cpp:69
static void addXPass(const char *msg, const char *file, int line)
Definition: qtestlog.cpp:280

◆ clearExpectFail()

static void clearExpectFail ( )
static

Definition at line 134 of file qtestresult.cpp.

Referenced by QTestResult::addFailure(), QTestResult::addSkip(), checkStatement(), QTestResult::expectFail(), and QTestResult::finishedCurrentTestFunction().

135 {
137  delete [] const_cast<char *>(QTest::expectFailComment);
139 }
static int expectFailMode
Definition: qtestresult.cpp:70
static const char * expectFailComment
Definition: qtestresult.cpp:69

◆ isExpectFailData()

static bool isExpectFailData ( const char *  dataIndex)
static

Definition at line 179 of file qtestresult.cpp.

Referenced by QTestResult::expectFail().

180 {
181  if (!dataIndex || dataIndex[0] == '\0')
182  return true;
184  return false;
185  if (strcmp(dataIndex, QTest::currentTestData->dataTag()) == 0)
186  return true;
187  return false;
188 }
static QTestData * currentTestData
Definition: qtestresult.cpp:56