Lumiera  0.pre.03
»edit your freedom«
suite.hpp
Go to the documentation of this file.
1 /*
2  SUITE.hpp - helper class for running collections of tests
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
40 #ifndef TESTHELPER_SUITE_H
41 #define TESTHELPER_SUITE_H
42 
43 #include <vector>
44 #include <string>
45 
46 
47 
48 namespace test {
49 
50  using std::string;
51 
52  // Forward declarations for run.hpp
53  class Test;
54  class Launcher;
55 
56  typedef std::vector<string> & Arg;
57 
58 
66  class Suite
67  {
68  string groupID_;
69  int exitCode_;
70 
71  public:
72  Suite (string groupID);
73  bool run (Arg cmdline);
74  void describe ();
75  int getExitCode () const;
76  static void enrol (Launcher *test, string testID, string groups);
77 
78  static const string ALLGROUP;
79  static const int TEST_OK;
80  static const int EXCEPTION_THROWN;
81  };
82 
83 
84 } // namespace test
85 #endif
Definition: run.hpp:49
static const int EXCEPTION_THROWN
exit code returned when any individual test threw
Definition: suite.hpp:80
bool run(Arg cmdline)
run all testcases contained in this Suite.
Definition: suite.cpp:205
Suite(string groupID)
create a suite comprised of all the testcases previously registered with this this group...
Definition: suite.cpp:145
static const string ALLGROUP
"magic" groupID containing all registered testcases
Definition: suite.hpp:78
interface: generic testcase creating functor.
Definition: run.hpp:72
void describe()
print to stdout an enumeration of all testcases in this suite, in a format suitable for use with Ceht...
Definition: suite.cpp:250
Enables running a collection of tests.
Definition: suite.hpp:66
static void enrol(Launcher *test, string testID, string groups)
register the given test-launcher, so it can be later accessed either as a member of one of the specif...
Definition: suite.cpp:117