ReactOS  0.4.14-dev-1007-g90d795b
test_main.cpp File Reference
#include "cppunit_proxy.h"
#include "file_reporter.h"
#include "cppunit_timer.h"
#include "stdio.h"
Include dependency graph for test_main.cpp:

Go to the source code of this file.

Functions

static void usage (const char *name)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 67 of file test_main.cpp.

67  {
68 
69  // CppUnit(mini) test launcher
70  // command line option syntax:
71  // test [OPTIONS]
72  // where OPTIONS are
73  // -t=CLASS[::TEST] run the test class CLASS or member test CLASS::TEST
74  // -x=CLASS[::TEST] run all except the test class CLASS or member test CLASS::TEST
75  // -f=FILE save output in file FILE instead of stdout
76  // -m monitor test(s) execution
77  const char *fileName = 0;
78  const char *testName = "";
79  const char *xtestName = "";
80  bool doMonitoring = false;
81 
82  for (int i = 1; i < argc; ++i) {
83  if (argv[i][0] == '-') {
84  if (!strncmp(argv[i], "-t=", 3)) {
85  testName = argv[i]+3;
86  continue;
87  }
88  else if (!strncmp(argv[i], "-f=", 3)) {
89  fileName = argv[i]+3;
90  continue;
91  }
92  else if (!strncmp(argv[i], "-x=", 3)) {
93  xtestName = argv[i]+3;
94  continue;
95  }
96  else if (Timer::supported() && !strncmp(argv[i], "-m", 2)) {
97  doMonitoring = true;
98  continue;
99  }
100  }
101 
102  // invalid option, we display normal usage.
103  usage(argv[0]);
104  return 1;
105  }
106 
107  CPPUNIT_NS::Reporter* reporter;
108  if (fileName != 0)
109  reporter = new FileReporter(fileName, doMonitoring);
110  else
111  reporter = new FileReporter(stdout, doMonitoring);
112 
113  int num_errors;
114  if (xtestName[0] != 0) {
115  num_errors = CPPUNIT_NS::TestCase::run(reporter, xtestName, true);
116  } else {
117  num_errors = CPPUNIT_NS::TestCase::run(reporter, testName);
118  }
119 
120  reporter->printSummary();
121  delete reporter;
122 
123  return num_errors;
124 }
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
FILE * stdout
static void usage(const char *name)
Definition: test_main.cpp:54
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int num_errors
Definition: odbccp32.c:60
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
static bool supported()
Definition: cppunit_timer.h:86

◆ usage()

static void usage ( const char name)
static

Definition at line 54 of file test_main.cpp.

55 {
56  printf("Usage : %s [-t=<class>[::<test>]] [-x=<class>[::<test>]] [-f=<file>]%s\n",
57  name, Timer::supported() ? " [-m]": "");
58  printf("\t[-t=<class>[::<test>]] : test class or class::test to execute;\n");
59  printf("\t[-x=<class>[::<test>]] : test class or class::test to exclude from execution;\n");
60  printf("\t[-f=<file>] : output file");
61  if (Timer::supported())
62  printf(";\n\t[-m] : monitor test execution, display time duration for each test\n");
63  else
64  printf("\n");
65 }
static bool supported()
Definition: cppunit_timer.h:86
Definition: name.c:38
#define printf
Definition: config.h:203

Referenced by main().