~brianaker/libmemcached/1164440

928.2.12 by Brian Aker
Check for failures while configuring client.
1
/*  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
2
 * 
929.1.208 by Brian Aker
Update license for libtest.
3
 *  libtest
928.2.12 by Brian Aker
Check for failures while configuring client.
4
 *
5
 *  Copyright (C) 2011 Data Differential, http://datadifferential.com/
929.1.208 by Brian Aker
Update license for libtest.
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
928.2.12 by Brian Aker
Check for failures while configuring client.
20
 */
21
929.1.208 by Brian Aker
Update license for libtest.
22
929.2.154 by Brian Aker
Update of libtest
23
#include <config.h>
929.1.178 by Brian Aker
Adding custom IOSTREAM for libtest.
24
#include <libtest/common.h>
928.2.12 by Brian Aker
Check for failures while configuring client.
25
26
#include <libtest/failed.h>
27
28
#include <iostream>
29
#include <string>
30
#include <vector>
31
929.1.185 by Brian Aker
Merge in all of libtest updates.
32
namespace libtest {
33
34
struct failed_st {
35
  failed_st(const std::string collection_arg, const std::string test_arg) :
928.2.12 by Brian Aker
Check for failures while configuring client.
36
    collection(collection_arg),
37
    test(test_arg)
929.1.185 by Brian Aker
Merge in all of libtest updates.
38
  { }
928.2.12 by Brian Aker
Check for failures while configuring client.
39
40
  std::string collection;
41
  std::string test;
42
};
43
929.1.185 by Brian Aker
Merge in all of libtest updates.
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