5 #ifdef GEOS_DEBUG_MSVC_USE_VLD
12 #include <tut_reporter.hpp>
14 #include <geos/unload.h>
22 test_runner_singleton runner
;
30 const std::string
module("geos_unit");
32 //[list] | [ group] [test]
33 cout
<< "Usage: " << module
<< " [OPTION] [TARGET]\n"
36 << " <none> run all tests in all groups\n"
37 << " <group name> run all tests from given group\n"
38 << " <group name> <test nr> run single test with given number from given group\n"
41 << " --list list all registered test groups\n"
42 << " --verbose run unit tests verbosely; displays non-error information\n"
43 << " --version print version information and exit\n"
44 << " --help print this message and exit\n"
47 << " " << module
<< " -v\n"
48 << " " << module
<< " list\n"
49 << " " << module
<< " geos::geom::Envelope\n"
50 << " " << module
<< " geos::geom::Envelope 2\n"
52 << "GEOS homepage: http://geos.osgeo.org" << endl
;
55 int main(int argc
, const char* argv
[])
59 if ( (argc
== 2 && std::string(argv
[1]) == "--help") || argc
> 3 )
65 std::cout
<< "===============================\n"
66 << " GEOS Test Suite Application\n"
67 << "===============================\n";
69 tut::runner
.get().set_callback(&visi
);
75 tut::runner
.get().run_tests();
77 else if ( argc
== 2 && std::string(argv
[1]) == "--list" )
79 tut::groupnames gl
= tut::runner
.get().list_groups();
80 tut::groupnames::const_iterator b
= gl
.begin();
81 tut::groupnames::const_iterator e
= gl
.end();
83 tut::groupnames::difference_type d
= std::distance(b
, e
);
85 std::cout
<< "Registered " << d
<< " test groups:\n" << std::endl
;
89 std::cout
<< " " << *b
<< std::endl
;
93 else if ( argc
== 2 && std::string(argv
[1]) != "--list" )
95 tut::runner
.get().run_tests(argv
[1]);
99 // TODO - mloskot - check if test group with given name exists
100 // TODO - mloskot - check if test case with given number exists
101 std::string
grpname(argv
[1]);
103 throw std::runtime_error("missing test group name");
105 tut::test_result result
;
106 tut::runner
.get().run_test(grpname
, std::atoi(argv
[2]), result
);
109 catch( const std::exception
& ex
)
111 std::cerr
<< "!!! GEOS Test Suite raised exception: " << ex
.what() << std::endl
;
114 // XXX - mloskot - this should be removed in future!
115 geos::io::Unload::Release();
117 return (visi
.all_ok() ? EXIT_SUCCESS
: EXIT_FAILURE
);