RoadTest.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/qhulltest/RoadTest.cpp#2 $$Change: 2062 $
5 ** $Date: 2016/01/17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 //pre-compiled headers
10 #include <iostream>
11 #include "RoadTest.h" // QT_VERSION
12 
13 #include <stdexcept>
14 
15 using std::cout;
16 using std::endl;
17 
18 namespace orgQhull {
19 
20 #
21 
22 QList<RoadTest*> RoadTest::
24 
25 int RoadTest::
26 s_test_count= 0;
27 
28 int RoadTest::
29 s_test_fail= 0;
30 
31 QStringList RoadTest::
33 
34 #
35 
36 void RoadTest::
39 {
40  s_test_count++;
41  if(QTest::currentTestFailed()){
43  }
44 }//cleanup
45 
46 #
47 
48 void RoadTest::
50 {
51  s_test_fail++;
52  QString className= metaObject()->className();
53  s_failed_tests << className + "::" + QTest::currentTestFunction();
54 }
55 
56 #
57 
58 void RoadTest::
60 {
61  foreach(RoadTest *testcase, s_testcases){
62  delete testcase;
63  }
64  s_failed_tests.clear();
65 }
66 
67 int RoadTest::
68 runTests(QStringList arguments)
69 {
70  int result= 0; // assume success
71 
72  foreach(RoadTest *testcase, s_testcases){
73  try{
74  result += QTest::qExec(testcase, arguments);
75  }catch(const std::exception &e){
76  cout << "FAIL! : Threw error ";
77  cout << e.what() << endl;
78  s_test_count++;
79  testcase->recordFailedTest();
80  // Qt 4.5.2 OK. In Qt 4.3.3, qtestcase did not clear currentTestObject
81  }
82  }
83  if(s_test_fail){
84  cout << "Failed " << s_test_fail << " of " << s_test_count << " tests.\n";
85  cout << s_failed_tests.join("\n").toLocal8Bit().constData() << std::endl;
86  }else{
87  cout << "Passed " << s_test_count << " tests.\n";
88  }
89  return result;
90 }//runTests
91 
92 }//orgQhull
93 
94 #include "moc/moc_RoadTest.cpp"
orgQhull::RoadTest::s_test_count
static int s_test_count
! List of testcases to execute. Initialized via add_...()
Definition: RoadTest.h:62
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::RoadTest::s_failed_tests
static QStringList s_failed_tests
! Number of failed tests
Definition: RoadTest.h:64
orgQhull::RoadTest::s_testcases
static QList< RoadTest * > s_testcases
Definition: RoadTest.h:61
orgQhull::RoadTest::deleteTests
static void deleteTests()
Definition: RoadTest.cpp:59
orgQhull::RoadTest
Definition: RoadTest.h:54
RoadTest.h
orgQhull::RoadTest::runTests
static int runTests(QStringList arguments)
Definition: RoadTest.cpp:68
orgQhull::RoadTest::s_test_fail
static int s_test_fail
! Total number of tests executed
Definition: RoadTest.h:63
orgQhull::RoadTest::cleanup
void cleanup()
Executed after each test.
Definition: RoadTest.cpp:38
orgQhull::RoadTest::recordFailedTest
void recordFailedTest()
Definition: RoadTest.cpp:49


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:15