aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/unit++/tester.h
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-08-25 21:25:45 +0000
committerVincent Richard <[email protected]>2005-08-25 21:25:45 +0000
commit5d18fce959ea74f99a8683c944c96881b2365bb2 (patch)
treed35b9177115606eedd84bbc64eb11aa21ca72878 /tests/lib/unit++/tester.h
parentFixed undefined symbol 'UNSPECIFIED_PORT'. (diff)
downloadvmime-5d18fce959ea74f99a8683c944c96881b2365bb2.tar.gz
vmime-5d18fce959ea74f99a8683c944c96881b2365bb2.zip
Moved to CppUnit for unit tests framework.
Diffstat (limited to 'tests/lib/unit++/tester.h')
-rw-r--r--tests/lib/unit++/tester.h77
1 files changed, 0 insertions, 77 deletions
diff --git a/tests/lib/unit++/tester.h b/tests/lib/unit++/tester.h
deleted file mode 100644
index 673ea559..00000000
--- a/tests/lib/unit++/tester.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2001 Claus Dr�by
-// Terms of use are in the file COPYING
-#ifndef _UNITPP_TESTER_H
-#define _UNITPP_TESTER_H
-#include <stack>
-#ifdef __UNITPP
-#include "unit++.h"
-#else
-#include <unit++/unit++.h>
-#endif
-namespace unitpp {
-/// A mostly internal class for keeping score.
-class res_cnt {
- int ok, fail, err;
-public:
- /// Create a 0 count.
- res_cnt() : ok(0), fail(0), err(0) {}
- /// Count one ok.
- void add_ok() { ++ok; }
- /// Count one fail.
- void add_fail() { ++fail; }
- /// Count one error.
- void add_err() { ++err; }
- /// get ok count.
- int n_ok() { return ok; }
- /// get fail count.
- int n_fail() { return fail; }
- /// get error count.
- int n_err() { return err; }
- /// get total count.
- int n() { return ok+fail+err; }
-};
-/**
- * The standard text based tester. It implements the visitor pattern for the
- * test and suite classes, and executes each test case in a depth first
- * traversal, toting the score of test cases.
- *
- * The class might be used for test executers aimed at other environments,
- * e.g. a GUI based version.
- *
- * Please note that this class is automagically instantiated by the main
- * method supplied in the library. This means that you might very well do all
- * your testing without directly laying hans on this fellow.
- */
-class tester : public visitor {
- std::ostream& os;
- bool verbose; // list succeded tests
- std::stack<res_cnt> accu;
- res_cnt n_suite, n_test;
- void disp(test& t, const std::string&);
- void write(test& t);
- void write(test& t, assertion_error& e);
- void write(test& t, std::exception& e);
- void write(test& t, int dummy);
-public:
- /**
- * Create a text tester.
- * \param os the stream to write results to.
- * \param verbose whether to report on succesful tests
- */
- tester(std::ostream& os, bool verbose = false) : os(os), verbose(verbose) {}
- /// Get the score for tests
- res_cnt res_tests() { return n_test; }
- /// Get the score for suites
- res_cnt res_suites() { return n_suite; }
- /// Write the summary
- virtual void summary();
- /// Part of the visitor pattern.
- virtual void visit(test&);
- /// Part of the visitor pattern.
- virtual void visit(suite&);
- /// Part of the visitor pattern; visit to suite after children.
- virtual void visit(suite& t, int);
-};
-
-}
-#endif