Update contrib.
2 #ifndef TEST_FRMWK_HPP___
3 #define TEST_FRMWK_HPP___
5 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
6 * Use, modification and distribution is subject to the
7 * Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0)
9 * $Date: 2003/11/23 03:29:56 $
16 //! Really simple test framework for counting and printing
20 static TestStats& instance() {static TestStats ts; return ts;}
21 void addPassingTest() {testcount_++; passcount_++;}
22 void addFailingTest() {testcount_++;}
23 unsigned int testcount() const {return testcount_;}
24 unsigned int passcount() const {return passcount_;}
25 void print(std::ostream& out = std::cout) const
27 out << testcount_ << " Tests Executed: " ;
28 if (passcount() != testcount()) {
29 out << (testcount() - passcount()) << " FAILURES";
32 out << "All Succeeded" << std::endl;
37 TestStats() : testcount_(0), passcount_(0) {}
38 unsigned int testcount_;
39 unsigned int passcount_;
43 bool check(const std::string& testname, bool testcond)
45 TestStats& stat = TestStats::instance();
47 std::cout << "Pass :: " << testname << " " << std::endl;
48 stat.addPassingTest();
52 stat.addFailingTest();
53 std::cout << "FAIL :: " << testname << " " << std::endl;
61 TestStats& stat = TestStats::instance();
63 return stat.testcount() - stat.passcount();