source: trunk/test/Suite.h @ 1525

Last change on this file since 1525 was 1525, checked in by Peter Johansson, 9 years ago

replace recursive Makefile with one single Makefile. Keeping multiple Makefile.ams which are included into main Makefile.am.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1#ifndef _theplu_svndigest_test_suite_
2#define _theplu_svndigest_test_suite_
3
4// $Id: Suite.h 1525 2012-10-01 06:31:07Z peter $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2012 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// used to tell automake that test should be skipped
27#define EXIT_SKIP 77
28
29// include from topdir to allow VPATH build
30#include "test/environment.h"
31
32#include <string>
33
34namespace theplu {
35namespace svndigest {
36  class Stats;
37  class StatsCollection;
38
39namespace test {
40
41  class Suite
42  {
43  public:
44    Suite(int argc, char* argv[], bool need_test_repo=false);
45    ~Suite(void);
46
47    /**
48       If b is false, set ok to false
49
50       \return b
51    */
52    bool add(bool b);
53
54    /**
55       \return EXIT_FAILURE or EXIT_SUCCESS depending on ok()
56     */
57    int exit_status(void) const;
58
59    /**
60       \return true if all tests are OK
61     */
62    bool ok(void) const;
63
64    std::ostream& out(void) const;
65
66    /**
67       Wrapper around std system that calls \a cmd to shell. If return
68       value is different from \a xret exception is thrown
69    */
70    void system(const std::string& cmd, int xret=0) const;
71
72    /**
73       \return true if we are running in verbose mode
74     */
75    bool verbose(void) const;
76
77  private:
78    bool ok_;
79
80    void checkout_test_wc(void) const;
81    void update_test_wc(void) const;
82  };
83
84  bool check_all(const Stats&, test::Suite&);
85  bool check_total(const Stats&, test::Suite&);
86  bool check_comment_or_copy(const Stats&, test::Suite&);
87
88  bool consistent(const StatsCollection&, test::Suite&);
89  bool consistent(const Stats&, test::Suite&);
90
91  // return true if a and b are different
92  // sends differences to cout
93  bool diff(const std::string& a, const std::string& b);
94
95  bool equal(const StatsCollection& a, const StatsCollection& b, 
96             test::Suite& suite);
97
98  bool equal(const Stats& a, const Stats& b, test::Suite& suite);
99
100  /**
101     \return absolute path to file
102     \param local_path path relative to builddir
103   */
104  std::string filename(const std::string& local_path);
105
106  /**
107     \return absolute path to file
108     \param path path relative to srcdir
109   */
110  std::string src_filename(const std::string& path);
111
112
113}}}
114
115#endif
Note: See TracBrowser for help on using the repository browser.