libStatGen Software 1
MemoryMapArrayTest.h
1/*
2 * Copyright (C) 2010 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#include <string>
18#include <iostream>
19
21{
22protected:
23 std::string m_title;
24 int m_failures;
25 int m_testNum;
26
27public:
28 UnitTest(const char *title) : m_title(title), m_failures(0), m_testNum(0) {;};
29 void test();
30 int getPassCount() {return m_testNum - m_failures;}
31 int getFailureCount() {return m_failures;}
32 const std::string getTitle() const {return m_title;}
33};
34
35std::ostream &operator << (std::ostream &stream, UnitTest &test)
36{
37 stream << test.getTitle() << " PASS: " << test.getPassCount() <<
38 " FAIL: " << test.getFailureCount() << std::endl;
39 return stream;
40}
41
InputFile & operator<<(InputFile &stream, const std::string &str)
Write to a file using streaming.
Definition: InputFile.h:736