aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/unit++/main.cc
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++/main.cc
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++/main.cc')
-rw-r--r--tests/lib/unit++/main.cc69
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/lib/unit++/main.cc b/tests/lib/unit++/main.cc
deleted file mode 100644
index 262e0553..00000000
--- a/tests/lib/unit++/main.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (C) 2001 Claus Dr�by
-// Terms of use are in the file COPYING
-#include "main.h"
-#include <algorithm>
-using namespace std;
-using namespace unitpp;
-
-bool unitpp::verbose = false;
-
-test_runner* runner = 0;
-
-test_runner::~test_runner()
-{
-}
-
-void unitpp::set_tester(test_runner* tr)
-{
- runner = tr;
-}
-
-int main(int argc, const char* argv[])
-{
- options().add("v", new options_utils::opt_flag(verbose));
- options().alias("verbose", "v");
- if (!options().parse(argc, argv))
- options().usage();
- plain_runner plain;
- if (!runner)
- runner = &plain;
- return runner->run_tests(argc, argv) ? 0 : 1;
-}
-
-namespace unitpp {
-options_utils::optmap& options()
-{
- static options_utils::optmap opts("[ testids... ]");
- return opts;
-}
-
-bool plain_runner::run_tests(int argc, const char** argv)
-{
- bool res = true;
- if (options().n() < argc)
- for (int i = options().n(); i < argc; ++i)
- res = res && run_test(argv[i]);
- else
- res = run_test();
- return res;
-}
-
-bool plain_runner::run_test(const string& id)
-{
- test* tp = suite::main().find(id);
- if (!tp) {
- return false;
- }
- return run_test(tp);
-}
-bool plain_runner::run_test(test* tp)
-{
- tester tst(cout, verbose);
- tp->visit(&tst);
- tst.summary();
- res_cnt res(tst.res_tests());
- return res.n_err() == 0 && res.n_fail() == 0;
-}
-
-}
-