source: trunk/test/Suite.h @ 1162

Last change on this file since 1162 was 1162, checked in by Peter Johansson, 13 years ago

new function exit_status in Suite and use it in all C++ tests

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#ifndef _theplu_svndigest_test_suite_
2#define _theplu_svndigest_test_suite_
3
4// $Id: Suite.h 1162 2010-08-13 17:30:03Z peter $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009 Peter Johansson
9
10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
11
12  svndigest is free software; you can redistribute it and/or modify it
13  under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 3 of the License, or
15  (at your option) any later version.
16
17  svndigest distributed in the hope that it will be useful, but
18  WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include "environment.h"
27
28#include <string>
29
30namespace theplu {
31namespace svndigest {
32  class Stats;
33  class StatsCollection;
34
35namespace test {
36
37  class Suite
38  {
39  public:
40    Suite(int argc, char* argv[], bool need_test_repo=false);
41    ~Suite(void);
42
43    /**
44       If b is false, set ok to false
45
46       \return b
47    */
48    bool add(bool b);
49
50    /**
51       \return EXIT_FAILURE or EXIT_SUCCESS depending on ok()
52     */
53    int exit_status(void) const;
54
55    /**
56       \return true if all tests are OK
57     */
58    bool ok(void) const;
59
60    std::ostream& out(void) const;
61
62    /**
63       \return true if we are running in verbose mode
64     */
65    bool verbose(void) const;
66
67  private:
68    bool ok_;
69
70    void checkout_test_wc(void) const;
71    void update_test_wc(void) const;
72  };
73
74  bool check_all(const Stats&, test::Suite&);
75  bool check_total(const Stats&, test::Suite&);
76  bool check_comment_or_copy(const Stats&, test::Suite&);
77
78  bool consistent(const StatsCollection&, test::Suite&);
79  bool consistent(const Stats&, test::Suite&);
80
81  bool equal(const StatsCollection& a, const StatsCollection& b, 
82             test::Suite& suite);
83
84  bool equal(const Stats& a, const Stats& b, test::Suite& suite);
85
86  /**
87     \return absolute path to file
88     \param local_path path relative to builddir
89   */
90  std::string filename(const std::string& local_path);
91
92  /**
93     \return absolute path to file
94     \param path path relative to srcdir
95   */
96  std::string src_filename(const std::string& path);
97}}}
98
99#endif
Note: See TracBrowser for help on using the repository browser.