Add none support for testing.
[awesomized/libmemcached] / libtest / failed.cc
1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
2 *
3 * libtest
4 *
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22
23 #include <config.h>
24 #include <libtest/common.h>
25
26 #include <libtest/failed.h>
27
28 #include <iostream>
29 #include <string>
30 #include <vector>
31
32 namespace libtest {
33
34 struct failed_st {
35 failed_st(const std::string collection_arg, const std::string test_arg) :
36 collection(collection_arg),
37 test(test_arg)
38 { }
39
40 std::string collection;
41 std::string test;
42 };
43
44 typedef std::vector<failed_st> Failures;
45
46 class Failed
47 {
48 private:
49 Failures failures;
50
51 public:
52 void push(const char *collection, const char *test)
53 {
54 failures.push_back(failed_st(collection, test));
55 }
56
57 void print_failed_test(void)
58 {
59 for (Failures::iterator iter= failures.begin(); iter != failures.end(); iter++)
60 {
61 Error << "\t" << (*iter).collection << " " << (*iter).test;
62 }
63 }
64 };
65
66 } // namespace libtest