Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:57

0001 /****************************************************************************
0002 **
0003 ** Copyright (c) 2008-2020 C.B. Barber. All rights reserved.
0004 ** $Id: //main/2019/qhull/src/qhulltest/RoadTest.h#3 $$Change: 3009 $
0005 ** $Date: 2020/07/30 $$Author: bbarber $
0006 **
0007 ****************************************************************************/
0008 
0009 #ifndef ROADTEST_H
0010 #define ROADTEST_H
0011 
0012 //pre-compiled with RoadTest.h
0013 #include <QObject>    // Qt C++ Framework
0014 #include <QtTest/QtTest>
0015 
0016 #define QHULL_USES_QT 1
0017 
0018 namespace orgQhull {
0019 
0020 #//!\name Defined here
0021 
0022     //! RoadTest -- Generic test for Qt's QTest
0023     class RoadTest;
0024     //! TESTadd_(t) -- Add a RoadTest
0025 
0026 /** Test Name objects using Qt's QTestLib
0027 
0028 Template:
0029 
0030 class Name_test : public RoadTest
0031 {
0032     Q_OBJECT
0033 #//!\name Test slot
0034 private slots:
0035     void t_name();
0036     //Executed before any test
0037     void initTestCase();
0038     void init();          // Each test
0039     //Executed after each test
0040     void cleanup(); //RoadTest::cleanup();
0041     // Executed after last test
0042     void cleanupTestCase();
0043 };
0044 
0045 void
0046 add_Name_test()
0047 {
0048     new Name_test();  // RoadTest::s_testcases
0049 }
0050 
0051 Send additional output to cout
0052 */
0053 
0054 class RoadTest : public QObject
0055 {
0056     Q_OBJECT
0057 
0058 #//!\name Class globals
0059 protected:
0060     static QList<RoadTest *>
0061                         s_testcases;    //! List of testcases to execute.  Initialized via add_...()
0062     static int          s_test_count;   //! Total number of tests executed
0063     static int          s_test_fail;    //! Number of failed tests
0064     static QStringList  s_failed_tests; //! List of failed tests
0065 
0066 #//!\name Test slots
0067 public slots:
0068     void cleanup();
0069 
0070 public:
0071 #//!\name Constructors, etc.
0072                         RoadTest()  { s_testcases.append(this); }
0073     virtual             ~RoadTest() {} // Derived from QObject
0074 
0075 #//!\name Helper
0076     void                recordFailedTest();
0077 
0078 
0079 #//!\name Class functions
0080     static void         deleteTests();
0081     static int          runTests(QStringList arguments);
0082 
0083 };//RoadTest
0084 
0085 #define TESTadd_(t) extern void t(); t();
0086 
0087 
0088 }//orgQhull
0089 
0090 namespace QTest{
0091 
0092 template<>
0093 inline char *
0094 toString(const std::string &s)
0095 {
0096     return qstrdup(s.c_str());
0097 }
0098 
0099 }//namespace QTest
0100 
0101 #endif //ROADTEST_H
0102