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)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
31 #ifndef TESTHELPER_SUITE_H
32 #define TESTHELPER_SUITE_H
33 
34 #include <vector>
35 #include <string>
36 #include <optional>
37 
38 
39 
40 namespace test {
41 
42  using std::string;
43  using opt_uint64 = std::optional<uint64_t>;
44 
45  // Forward declarations for run.hpp
46  class Test;
47  class Launcher;
48 
49  typedef std::vector<string> & Arg;
50 
51 
59  class Suite
60  {
61  string groupID_;
62  int exitCode_;
63 
64  public:
65  Suite (string groupID, opt_uint64 seed);
66  bool run (Arg cmdline);
67  void describe ();
68  int getExitCode () const;
69  static void enrol (Launcher *test, string testID, string groups);
70 
71  static const string ALLGROUP;
72  static const int TEST_OK;
73  static const int EXCEPTION_THROWN;
74  };
75 
76 
77 } // namespace test
78 #endif
Definition: run.hpp:40
Suite(string groupID, opt_uint64 seed)
create a suite comprised of all the testcases previously registered with this this group...
Definition: suite.cpp:158
static const int EXCEPTION_THROWN
exit code returned when any individual test threw
Definition: suite.hpp:73
bool run(Arg cmdline)
run all testcases contained in this Suite.
Definition: suite.cpp:251
static const string ALLGROUP
"magic" groupID containing all registered testcases
Definition: suite.hpp:71
interface: generic testcase creating functor.
Definition: run.hpp:68
void describe()
print to stdout an enumeration of all testcases in this suite, in a format suitable for use with Ceht...
Definition: suite.cpp:299
Enables running a collection of tests.
Definition: suite.hpp:59
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:131