Thread: [complement-svn] SF.net SVN: complement: [1600] trunk/complement/explore/app/exam
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-07-06 06:29:30
|
Revision: 1600 http://svn.sourceforge.net/complement/?rev=1600&view=rev Author: complement Date: 2007-07-05 23:29:26 -0700 (Thu, 05 Jul 2007) Log Message: ----------- state zero Added Paths: ----------- trunk/complement/explore/app/exam/Makefile trunk/complement/explore/app/exam/Makefile.inc trunk/complement/explore/app/exam/suite.cc trunk/complement/explore/app/exam/suite.h trunk/complement/explore/app/exam/zero.cc Property Changed: ---------------- trunk/complement/explore/app/exam/ Property changes on: trunk/complement/explore/app/exam ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/app/exam/Makefile =================================================================== --- trunk/complement/explore/app/exam/Makefile (rev 0) +++ trunk/complement/explore/app/exam/Makefile 2007-07-06 06:29:26 UTC (rev 1600) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <07/07/05 09:31:15 ptr> + +SRCROOT := ../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + +INCLUDES += -I${BOOST_DIR} + +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/app/exam/Makefile.inc =================================================================== --- trunk/complement/explore/app/exam/Makefile.inc (rev 0) +++ trunk/complement/explore/app/exam/Makefile.inc 2007-07-06 06:29:26 UTC (rev 1600) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = zero +SRC_CC = zero.cc suite.cc Added: trunk/complement/explore/app/exam/suite.cc =================================================================== --- trunk/complement/explore/app/exam/suite.cc (rev 0) +++ trunk/complement/explore/app/exam/suite.cc 2007-07-06 06:29:26 UTC (rev 1600) @@ -0,0 +1,79 @@ +// -*- C++ -*- Time-stamp: <07/07/06 09:55:44 ptr> + +#include "suite.h" +#include <boost/graph/breadth_first_search.hpp> +#include <stack> + +namespace exam { + +using namespace std; +using namespace boost; + + +template <class VertexList, class Tag> +struct vertex_recorder : + public base_visitor<vertex_recorder<VertexList,Tag> > +{ + typedef Tag event_filter; + + vertex_recorder(VertexList& pa) : + m_vertex(pa) + { } + + template <class Vertex, class Graph> + void operator()(Vertex v, const Graph& g) + { m_vertex.push_back( v ); } + + VertexList& m_vertex; +}; + +template <class VertexList, class Tag> +vertex_recorder<VertexList, Tag> record_vertexes(VertexList& pa, Tag) +{ return vertex_recorder<VertexList, Tag>(pa); } + +test_suite::test_suite() : + root( add_vertex( white_color, g ) ) +{ + color = get( vertex_color, g ); + testcase = get( vertex_testcase, g ); + _test[root] = 0; +} + +void test_suite::girdle( int start ) +{ + stack<vertex_t> buffer; + list<vertex_t> v; + breadth_first_visit( g, root, buffer, + make_bfs_visitor(record_vertexes(v,on_discover_vertex())), + color ); + + v.pop_front(); // remove root, it empty + + for ( list<vertex_t>::const_iterator i = v.begin(); i != v.end(); ++i ) { + try { + (*_test[*i])(); + } + catch ( ... ) { + } + } +} + +test_suite::test_case_type test_suite::add( test_suite::func_type f ) +{ + vertex_t v = add_vertex( white_color, g); + add_edge( root, v, g ); + _test[v] = detail::make_test_case( detail::call( f ) ); + + return v; +} + +test_suite::test_case_type test_suite::add( test_suite::func_type f, test_suite::test_case_type depends ) +{ + vertex_t v = add_vertex( white_color, g); + add_edge( depends, v, g ); + _test[v] = detail::make_test_case( detail::call( f ) ); + + return v; +} + +} // namespace exam Added: trunk/complement/explore/app/exam/suite.h =================================================================== --- trunk/complement/explore/app/exam/suite.h (rev 0) +++ trunk/complement/explore/app/exam/suite.h 2007-07-06 06:29:26 UTC (rev 1600) @@ -0,0 +1,154 @@ +// -*- C++ -*- Time-stamp: <07/07/06 09:58:06 ptr> + +#ifndef __suite_h +#define __suite_h + +#include <iostream> +#include <sstream> +#include <map> +#include <boost/graph/adjacency_list.hpp> + +enum vertex_testcase_t { vertex_testcase }; + +namespace boost { + BOOST_INSTALL_PROPERTY( vertex, testcase ); +} // namespace boost + +namespace exam { + +namespace detail { + +/* +struct invoker +{ + template <typename F> + void invoke( F& f ) + { f(); } +}; +*/ + +struct call_impl +{ + virtual ~call_impl() + { } + virtual void invoke() = 0; +}; + +template <typename F> +class call_impl_t : + public call_impl +{ + public: + explicit call_impl_t( F f ) : + _f( f ) + { } + + virtual void invoke() + { /* invoker().invoke( _f ); */ _f(); } + + private: + F _f; +}; + +class call +{ + public: + call() + { } + + template <class F> + call( F f ) : + _f( new call_impl_t<F>(f) ) + { } + + void operator()() + { _f->invoke(); } + + private: + call_impl *_f; +}; + +template <class TC> +class method_invoker +{ + public: + typedef void (TC::*mf_type)(); + method_invoker( TC& instance, mf_type f ) : + _inst(instance), + _func(f) + { } + + void operator()() + { _inst.*_func(); } + + private: + TC& _inst; + mf_type _func; +}; + +class test_case +{ + public: + test_case( const call& f ) : + _tc( f ) + { } + + void operator ()() + { _tc(); } + + private: + call _tc; +}; + +inline test_case *make_test_case( const call& f ) +{ + return new test_case( f ); +} + +template <class TC> +inline test_case *make_test_case( void (TC::*f)(), TC& instance ) +{ + return new test_case( method_invoker<TC>(instance, f) ); +} + +} // namespace detail + +class test_suite +{ + private: + typedef boost::property<vertex_testcase_t,int> TestCaseProperty; + typedef boost::property<boost::vertex_color_t, boost::default_color_type, TestCaseProperty> VColorProperty; + + typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, VColorProperty > graph_t; + typedef boost::graph_traits<graph_t>::vertex_iterator vertex_iterator_t; + + typedef boost::graph_traits<graph_t>::vertex_descriptor vertex_t; + typedef boost::property_map<graph_t,boost::vertex_color_t>::type vertex_color_map_t; + typedef boost::property_map<graph_t,vertex_testcase_t>::type vertex_testcase_map_t; + + public: + typedef void (*func_type)(); + typedef vertex_t test_case_type; + + test_suite(); + + test_case_type add( func_type ); + test_case_type add( func_type, test_case_type ); + + void girdle( int start ); + + private: + graph_t g; + vertex_t root; + vertex_color_map_t color; + vertex_testcase_map_t testcase; + + std::map<vertex_t,detail::test_case *> _test; +}; + +typedef test_suite::test_case_type test_case_type; + +} // namespace exam + +#endif // __suite_h + Added: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc (rev 0) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-06 06:29:26 UTC (rev 1600) @@ -0,0 +1,69 @@ +#define FIT_EXAM + +#ifdef FIT_EXAM +# define EXAM_CHECK(C) if ( !(C) ) { exam::report( __FILE__, __LINE__, false, #C ); } else if ( exam::base::is_trace() ) { exam::report( __FILE__, __LINE__, true, #C ); } +# define EXAM_MESSAGE(M) +#else +# define EXAM_CHECK(C) +# define EXAM_MESSAGE(M) +#endif + + +#include <cstdio> +#include <iostream> + +#include "suite.h" + +namespace exam { + +class base +{ + public: + enum { + trace = 1 + }; + + static int flags(); + static bool is_trace(); + + private: + + static int _flags; +}; + +void _report0( const char *file, int line, bool cnd, const char *expr ) +{ + std::cerr << file << ":" << line << ": " << (cnd ? "pass" : "fail" ) << " \"" << expr << "\"" + << std::endl; +} + +void _report1( const char *file, int line, bool cnd, const char *expr ) +{ + printf( "%s:%d: %s \"%s\"\n", file, line, (cnd ? "pass" : "fail"), expr ); +} + +void _report2( const char *file, int line, bool cnd, const char *expr ) +{ + fprintf( stderr, "%s:%d: %s \"%s\"\n", file, line, (cnd ? "pass" : "fail"), expr ); +} + +void (*report)( const char *, int, bool, const char * ) = _report0; + +} // namespec exam + +void func() +{ + EXAM_CHECK(false); +} + +int main( int argc, char **argv ) +{ + exam::test_suite t; + + t.add( func ); + + t.girdle( 0 ); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-10 17:12:26
|
Revision: 1601 http://svn.sourceforge.net/complement/?rev=1601&view=rev Author: complement Date: 2007-07-10 10:12:18 -0700 (Tue, 10 Jul 2007) Log Message: ----------- function and class function work Modified Paths: -------------- trunk/complement/explore/app/exam/suite.cc trunk/complement/explore/app/exam/suite.h trunk/complement/explore/app/exam/zero.cc Modified: trunk/complement/explore/app/exam/suite.cc =================================================================== --- trunk/complement/explore/app/exam/suite.cc 2007-07-06 06:29:26 UTC (rev 1600) +++ trunk/complement/explore/app/exam/suite.cc 2007-07-10 17:12:18 UTC (rev 1601) @@ -1,9 +1,12 @@ -// -*- C++ -*- Time-stamp: <07/07/06 09:55:44 ptr> +// -*- C++ -*- Time-stamp: <07/07/08 23:39:10 ptr> #include "suite.h" #include <boost/graph/breadth_first_search.hpp> #include <stack> +#include <cstdio> +#include <iostream> + namespace exam { using namespace std; @@ -39,8 +42,15 @@ _test[root] = 0; } -void test_suite::girdle( int start ) +test_suite::~test_suite() { + for ( test_case_map_type::iterator i = _test.begin(); i != _test.end(); ++i ) { + delete i->second; + } +} + +void test_suite::girdle() +{ stack<vertex_t> buffer; list<vertex_t> v; breadth_first_visit( g, root, buffer, @@ -58,6 +68,26 @@ } } +void test_suite::girdle( test_suite::test_case_type start ) +{ + stack<vertex_t> buffer; + list<vertex_t> v; + breadth_first_visit( g, start, buffer, + make_bfs_visitor(record_vertexes(v,on_discover_vertex())), + color ); + + v.pop_front(); // remove root, it empty + + for ( list<vertex_t>::const_iterator i = v.begin(); i != v.end(); ++i ) { + try { + (*_test[*i])(); + } + catch ( ... ) { + } + } +} + + test_suite::test_case_type test_suite::add( test_suite::func_type f ) { vertex_t v = add_vertex( white_color, g); @@ -76,4 +106,38 @@ return v; } +int test_suite::flags() +{ + return _flags; +} + +bool test_suite::is_trace() +{ + return (_flags & trace) != 0; +} + +void _report0( const char *file, int line, bool cnd, const char *expr ) +{ + std::cerr << file << ":" << line << ": " << (cnd ? "pass" : "fail" ) << ": " << expr + << std::endl; +} + +void _report1( const char *file, int line, bool cnd, const char *expr ) +{ + printf( "%s:%d: %s: %s\n", file, line, (cnd ? "pass" : "fail"), expr ); +} + +void _report2( const char *file, int line, bool cnd, const char *expr ) +{ + fprintf( stderr, "%s:%d: %s: %s\n", file, line, (cnd ? "pass" : "fail"), expr ); +} + +int test_suite::_flags = 0; +void (*test_suite::_report)( const char *, int, bool, const char * ) = _report0; + +void test_suite::report( const char *file, int line, bool cnd, const char *expr ) +{ + (*test_suite::_report)( file, line, cnd, expr ); +} + } // namespace exam Modified: trunk/complement/explore/app/exam/suite.h =================================================================== --- trunk/complement/explore/app/exam/suite.h 2007-07-06 06:29:26 UTC (rev 1600) +++ trunk/complement/explore/app/exam/suite.h 2007-07-10 17:12:18 UTC (rev 1601) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/06 09:58:06 ptr> +// -*- C++ -*- Time-stamp: <07/07/08 23:40:05 ptr> #ifndef __suite_h #define __suite_h @@ -18,15 +18,6 @@ namespace detail { -/* -struct invoker -{ - template <typename F> - void invoke( F& f ) - { f(); } -}; -*/ - struct call_impl { virtual ~call_impl() @@ -44,28 +35,20 @@ { } virtual void invoke() - { /* invoker().invoke( _f ); */ _f(); } + { _f(); } private: F _f; }; -class call +class dummy { public: - call() + virtual void f() { } - - template <class F> - call( F f ) : - _f( new call_impl_t<F>(f) ) + private: + virtual ~dummy() { } - - void operator()() - { _f->invoke(); } - - private: - call_impl *_f; }; template <class TC> @@ -73,19 +56,47 @@ { public: typedef void (TC::*mf_type)(); - method_invoker( TC& instance, mf_type f ) : + + explicit method_invoker( TC& instance, mf_type f ) : _inst(instance), _func(f) { } + method_invoker( const method_invoker<TC>& m ) : + _inst( m._inst ), + _func( m._func ) + { } + void operator()() - { _inst.*_func(); } + { (_inst.*_func)(); } private: + method_invoker& operator =( const method_invoker<TC>& ) + { return *this; } + TC& _inst; mf_type _func; }; +class call +{ + public: + call() + { } + + template <class F> + call( F f ) + { new (&_buf[0]) call_impl_t<F>(f); } + + void operator()() + { reinterpret_cast<call_impl *>(&_buf[0])->invoke(); } + + private: + // call_impl *_f; + char _buf[((sizeof(call_impl_t<method_invoker<dummy> >)+64) / 64) << 6]; +}; + + class test_case { public: @@ -131,24 +142,73 @@ typedef vertex_t test_case_type; test_suite(); + ~test_suite(); test_case_type add( func_type ); test_case_type add( func_type, test_case_type ); - void girdle( int start ); + template <class TC> + test_case_type add( void (TC::*)(), TC& ); + template <class TC> + test_case_type add( void (TC::*)(), TC&, test_case_type ); + + void girdle(); + void girdle( test_case_type start ); + + enum { + trace = 1 + }; + + static int flags(); + static bool is_trace(); + static void report( const char *, int, bool, const char * ); + private: graph_t g; vertex_t root; vertex_color_map_t color; vertex_testcase_map_t testcase; - std::map<vertex_t,detail::test_case *> _test; + typedef std::map<vertex_t,detail::test_case *> test_case_map_type; + test_case_map_type _test; + + static int _flags; + static void (*_report)( const char *, int, bool, const char * ); }; +template <class TC> +test_suite::test_case_type test_suite::add( void (TC::*f)(), TC& instance ) +{ + vertex_t v = boost::add_vertex( boost::white_color, g); + boost::add_edge( root, v, g ); + _test[v] = detail::make_test_case( f, instance ); + + return v; +} + +template <class TC> +test_suite::test_case_type test_suite::add( void (TC::*f)(), TC& instance, test_suite::test_case_type depends ) +{ + vertex_t v = boost::add_vertex( boost::white_color, g); + boost::add_edge( depends, v, g ); + _test[v] = detail::make_test_case( f, instance ); + + return v; +} + typedef test_suite::test_case_type test_case_type; } // namespace exam +#ifdef FIT_EXAM +# define EXAM_CHECK(C) if ( !(C) ) { exam::test_suite::report( __FILE__, __LINE__, false, #C ); } else if ( exam::test_suite::is_trace() ) { exam::test_suite::report( __FILE__, __LINE__, true, #C ); } +# define EXAM_MESSAGE(M) +#else +# define EXAM_CHECK(C) +# define EXAM_MESSAGE(M) +#endif + + #endif // __suite_h Modified: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc 2007-07-06 06:29:26 UTC (rev 1600) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-10 17:12:18 UTC (rev 1601) @@ -1,66 +1,31 @@ #define FIT_EXAM -#ifdef FIT_EXAM -# define EXAM_CHECK(C) if ( !(C) ) { exam::report( __FILE__, __LINE__, false, #C ); } else if ( exam::base::is_trace() ) { exam::report( __FILE__, __LINE__, true, #C ); } -# define EXAM_MESSAGE(M) -#else -# define EXAM_CHECK(C) -# define EXAM_MESSAGE(M) -#endif - - -#include <cstdio> -#include <iostream> - #include "suite.h" -namespace exam { +void func() +{ + EXAM_CHECK(false); +} -class base +class test_x { public: - enum { - trace = 1 - }; - - static int flags(); - static bool is_trace(); - private: - - static int _flags; + void f() + { + EXAM_CHECK(false); + } }; -void _report0( const char *file, int line, bool cnd, const char *expr ) -{ - std::cerr << file << ":" << line << ": " << (cnd ? "pass" : "fail" ) << " \"" << expr << "\"" - << std::endl; -} -void _report1( const char *file, int line, bool cnd, const char *expr ) -{ - printf( "%s:%d: %s \"%s\"\n", file, line, (cnd ? "pass" : "fail"), expr ); -} - -void _report2( const char *file, int line, bool cnd, const char *expr ) -{ - fprintf( stderr, "%s:%d: %s \"%s\"\n", file, line, (cnd ? "pass" : "fail"), expr ); -} - -void (*report)( const char *, int, bool, const char * ) = _report0; - -} // namespec exam - -void func() -{ - EXAM_CHECK(false); -} - int main( int argc, char **argv ) { exam::test_suite t; + test_x tx; + t.add( func ); + t.add( &test_x::f, tx ); t.girdle( 0 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-11 07:35:15
|
Revision: 1602 http://svn.sourceforge.net/complement/?rev=1602&view=rev Author: complement Date: 2007-07-11 00:35:11 -0700 (Wed, 11 Jul 2007) Log Message: ----------- test functions return int, conditional run (from dependency) Modified Paths: -------------- trunk/complement/explore/app/exam/suite.cc trunk/complement/explore/app/exam/suite.h trunk/complement/explore/app/exam/zero.cc Modified: trunk/complement/explore/app/exam/suite.cc =================================================================== --- trunk/complement/explore/app/exam/suite.cc 2007-07-10 17:12:18 UTC (rev 1601) +++ trunk/complement/explore/app/exam/suite.cc 2007-07-11 07:35:11 UTC (rev 1602) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/08 23:39:10 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 11:10:45 ptr> #include "suite.h" #include <boost/graph/breadth_first_search.hpp> @@ -11,61 +11,87 @@ using namespace std; using namespace boost; +using namespace detail; +namespace detail { -template <class VertexList, class Tag> +template <class Tag> struct vertex_recorder : - public base_visitor<vertex_recorder<VertexList,Tag> > + public base_visitor<vertex_recorder<Tag> > { typedef Tag event_filter; - vertex_recorder(VertexList& pa) : - m_vertex(pa) + vertex_recorder(test_suite& ts) : + _suite(ts) { } template <class Vertex, class Graph> void operator()(Vertex v, const Graph& g) - { m_vertex.push_back( v ); } + { _suite.run_test_case( v ); } - VertexList& m_vertex; + test_suite& _suite; }; -template <class VertexList, class Tag> -vertex_recorder<VertexList, Tag> record_vertexes(VertexList& pa, Tag) -{ return vertex_recorder<VertexList, Tag>(pa); } +template <class Tag> +vertex_recorder<Tag> record_vertexes(test_suite& ts, Tag) +{ return vertex_recorder<Tag>(ts); } +template <class Tag> +struct skip_recorder : + public base_visitor<skip_recorder<Tag> > +{ + typedef Tag event_filter; + + skip_recorder(test_suite& ts) : + _suite(ts) + { } + + template <class Edge, class Graph> + void operator()(Edge e, const Graph& g) + { + // typename graph_traits<Graph>::vertex_descriptor u = boost::source( e, g ); + // typename graph_traits<Graph>::vertex_descriptor v = boost::target( e, g ); + _suite.check_test_case( boost::source( e, g ), boost::target( e, g ) ); + } + + test_suite& _suite; +}; + +template <class Tag> +skip_recorder<Tag> record_skip(test_suite& ts, Tag) +{ return skip_recorder<Tag>(ts); } + +int _root_func() +{ + return 0; +} + +} // namespace detail + test_suite::test_suite() : root( add_vertex( white_color, g ) ) { color = get( vertex_color, g ); testcase = get( vertex_testcase, g ); - _test[root] = 0; + _test[root].tc = detail::make_test_case( detail::call( _root_func ) ); + _test[root].state = 0; } test_suite::~test_suite() { for ( test_case_map_type::iterator i = _test.begin(); i != _test.end(); ++i ) { - delete i->second; + delete i->second.tc; } } void test_suite::girdle() { stack<vertex_t> buffer; - list<vertex_t> v; breadth_first_visit( g, root, buffer, - make_bfs_visitor(record_vertexes(v,on_discover_vertex())), + make_bfs_visitor( + make_pair( record_vertexes(*this,on_discover_vertex()), + record_skip(*this,on_examine_edge()) ) ), color ); - - v.pop_front(); // remove root, it empty - - for ( list<vertex_t>::const_iterator i = v.begin(); i != v.end(); ++i ) { - try { - (*_test[*i])(); - } - catch ( ... ) { - } - } } void test_suite::girdle( test_suite::test_case_type start ) @@ -73,18 +99,10 @@ stack<vertex_t> buffer; list<vertex_t> v; breadth_first_visit( g, start, buffer, - make_bfs_visitor(record_vertexes(v,on_discover_vertex())), + make_bfs_visitor( + make_pair( record_vertexes(*this,on_discover_vertex()), + record_skip(*this,on_examine_edge()) ) ), color ); - - v.pop_front(); // remove root, it empty - - for ( list<vertex_t>::const_iterator i = v.begin(); i != v.end(); ++i ) { - try { - (*_test[*i])(); - } - catch ( ... ) { - } - } } @@ -92,7 +110,8 @@ { vertex_t v = add_vertex( white_color, g); add_edge( root, v, g ); - _test[v] = detail::make_test_case( detail::call( f ) ); + _test[v].tc = detail::make_test_case( detail::call( f ) ); + _test[v].state = 0; return v; } @@ -101,7 +120,8 @@ { vertex_t v = add_vertex( white_color, g); add_edge( depends, v, g ); - _test[v] = detail::make_test_case( detail::call( f ) ); + _test[v].tc = detail::make_test_case( detail::call( f ) ); + _test[v].state = 0; return v; } @@ -140,4 +160,25 @@ (*test_suite::_report)( file, line, cnd, expr ); } +void test_suite::run_test_case( test_suite::vertex_t v ) +{ + try { + if ( _test[v].state == 0 ) { + if ( (*_test[v].tc)() != 0 ) { + _test[v].state = fail; + } + } + } + catch ( ... ) { + _test[v].state = fail; + } +} + +void test_suite::check_test_case( test_suite::vertex_t u, test_suite::vertex_t v ) +{ + if ( _test[u].state != 0 ) { + _test[v].state = skip; + } +} + } // namespace exam Modified: trunk/complement/explore/app/exam/suite.h =================================================================== --- trunk/complement/explore/app/exam/suite.h 2007-07-10 17:12:18 UTC (rev 1601) +++ trunk/complement/explore/app/exam/suite.h 2007-07-11 07:35:11 UTC (rev 1602) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/08 23:40:05 ptr> +// -*- C++ -*- Time-stamp: <07/07/11 11:02:41 ptr> #ifndef __suite_h #define __suite_h @@ -22,7 +22,7 @@ { virtual ~call_impl() { } - virtual void invoke() = 0; + virtual int invoke() = 0; }; template <typename F> @@ -34,8 +34,8 @@ _f( f ) { } - virtual void invoke() - { _f(); } + virtual int invoke() + { return _f(); } private: F _f; @@ -44,7 +44,7 @@ class dummy { public: - virtual void f() + virtual int f() { } private: virtual ~dummy() @@ -55,7 +55,7 @@ class method_invoker { public: - typedef void (TC::*mf_type)(); + typedef int (TC::*mf_type)(); explicit method_invoker( TC& instance, mf_type f ) : _inst(instance), @@ -67,8 +67,8 @@ _func( m._func ) { } - void operator()() - { (_inst.*_func)(); } + int operator()() + { return (_inst.*_func)(); } private: method_invoker& operator =( const method_invoker<TC>& ) @@ -88,8 +88,8 @@ call( F f ) { new (&_buf[0]) call_impl_t<F>(f); } - void operator()() - { reinterpret_cast<call_impl *>(&_buf[0])->invoke(); } + int operator()() + { return reinterpret_cast<call_impl *>(&_buf[0])->invoke(); } private: // call_impl *_f; @@ -104,8 +104,8 @@ _tc( f ) { } - void operator ()() - { _tc(); } + int operator ()() + { return _tc(); } private: call _tc; @@ -117,7 +117,7 @@ } template <class TC> -inline test_case *make_test_case( void (TC::*f)(), TC& instance ) +inline test_case *make_test_case( int (TC::*f)(), TC& instance ) { return new test_case( method_invoker<TC>(instance, f) ); } @@ -138,7 +138,7 @@ typedef boost::property_map<graph_t,vertex_testcase_t>::type vertex_testcase_map_t; public: - typedef void (*func_type)(); + typedef int (*func_type)(); typedef vertex_t test_case_type; test_suite(); @@ -148,14 +148,17 @@ test_case_type add( func_type, test_case_type ); template <class TC> - test_case_type add( void (TC::*)(), TC& ); + test_case_type add( int (TC::*)(), TC& ); template <class TC> - test_case_type add( void (TC::*)(), TC&, test_case_type ); + test_case_type add( int (TC::*)(), TC&, test_case_type ); void girdle(); void girdle( test_case_type start ); + void run_test_case( vertex_t v ); + void check_test_case( vertex_t u, vertex_t v ); + enum { trace = 1 }; @@ -165,12 +168,23 @@ static void report( const char *, int, bool, const char * ); private: + enum { + fail = 1, + skip = 2 + }; + graph_t g; vertex_t root; vertex_color_map_t color; vertex_testcase_map_t testcase; - typedef std::map<vertex_t,detail::test_case *> test_case_map_type; + struct test_case_collect + { + detail::test_case *tc; + int state; + }; + + typedef std::map<vertex_t,test_case_collect> test_case_map_type; test_case_map_type _test; static int _flags; @@ -178,21 +192,23 @@ }; template <class TC> -test_suite::test_case_type test_suite::add( void (TC::*f)(), TC& instance ) +test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( root, v, g ); - _test[v] = detail::make_test_case( f, instance ); + _test[v].tc = detail::make_test_case( f, instance ); + _test[v].state = 0; return v; } template <class TC> -test_suite::test_case_type test_suite::add( void (TC::*f)(), TC& instance, test_suite::test_case_type depends ) +test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, test_suite::test_case_type depends ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( depends, v, g ); - _test[v] = detail::make_test_case( f, instance ); + _test[v].tc = detail::make_test_case( f, instance ); + _test[v].state = 0; return v; } @@ -202,7 +218,7 @@ } // namespace exam #ifdef FIT_EXAM -# define EXAM_CHECK(C) if ( !(C) ) { exam::test_suite::report( __FILE__, __LINE__, false, #C ); } else if ( exam::test_suite::is_trace() ) { exam::test_suite::report( __FILE__, __LINE__, true, #C ); } +# define EXAM_CHECK(C) if ( !(C) ) { exam::test_suite::report( __FILE__, __LINE__, false, #C ); return 1; } else if ( exam::test_suite::is_trace() ) { exam::test_suite::report( __FILE__, __LINE__, true, #C ); } # define EXAM_MESSAGE(M) #else # define EXAM_CHECK(C) Modified: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc 2007-07-10 17:12:18 UTC (rev 1601) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-11 07:35:11 UTC (rev 1602) @@ -2,18 +2,22 @@ #include "suite.h" -void func() +int func() { EXAM_CHECK(false); + + return 0; } class test_x { public: - void f() + int f() { EXAM_CHECK(false); + + return 0; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-11 19:56:55
|
Revision: 1605 http://svn.sourceforge.net/complement/?rev=1605&view=rev Author: complement Date: 2007-07-11 12:56:54 -0700 (Wed, 11 Jul 2007) Log Message: ----------- test suite messages, initial Modified Paths: -------------- trunk/complement/explore/app/exam/suite.cc trunk/complement/explore/app/exam/suite.h trunk/complement/explore/app/exam/zero.cc Modified: trunk/complement/explore/app/exam/suite.cc =================================================================== --- trunk/complement/explore/app/exam/suite.cc 2007-07-11 18:52:43 UTC (rev 1604) +++ trunk/complement/explore/app/exam/suite.cc 2007-07-11 19:56:54 UTC (rev 1605) @@ -61,20 +61,39 @@ skip_recorder<Tag> record_skip(test_suite& ts, Tag) { return skip_recorder<Tag>(ts); } -int _root_func() +} // namespace detail + +int test_suite::_root_func() { - return 0; + return test_suite::init; } -} // namespace detail +test_suite::test_suite( const string& name ) : + root( add_vertex( white_color, g ) ), + _suite_name( name ) +{ + color = get( vertex_color, g ); + testcase = get( vertex_testcase, g ); + _test[root].tc = detail::make_test_case( detail::call( _root_func ) ); + _test[root].state = 0; + _stat.total = 0; + _stat.passed = 0; + _stat.failed = 0; + _stat.skipped = 0; +} -test_suite::test_suite() : - root( add_vertex( white_color, g ) ) +test_suite::test_suite( const char *name ) : + root( add_vertex( white_color, g ) ), + _suite_name( name ) { color = get( vertex_color, g ); testcase = get( vertex_testcase, g ); _test[root].tc = detail::make_test_case( detail::call( _root_func ) ); _test[root].state = 0; + _stat.total = 0; + _stat.passed = 0; + _stat.failed = 0; + _stat.skipped = 0; } test_suite::~test_suite() @@ -87,41 +106,66 @@ void test_suite::girdle() { stack<vertex_t> buffer; + cerr << "== Begin test suite\n"; breadth_first_visit( g, root, buffer, make_bfs_visitor( make_pair( record_vertexes(*this,on_discover_vertex()), record_skip(*this,on_examine_edge()) ) ), color ); + cerr << "== End test suite\n"; + if ( _stat.failed != 0 ) { + cerr << "*** FAIL "; + } else { + cerr << "*** PASS "; + } + cerr << _suite_name + << " (+" << _stat.passed + << "-" << _stat.failed + << "~" << _stat.skipped << "/" << _stat.total << ") ***" << endl; } void test_suite::girdle( test_suite::test_case_type start ) { stack<vertex_t> buffer; - list<vertex_t> v; + cerr << "== Begin test suite\n"; breadth_first_visit( g, start, buffer, make_bfs_visitor( make_pair( record_vertexes(*this,on_discover_vertex()), record_skip(*this,on_examine_edge()) ) ), color ); + cerr << "== End test suite\n"; + if ( _stat.failed != 0 ) { + cerr << "*** FAIL "; + } else { + cerr << "*** PASS "; + } + cerr << _suite_name + << " (+" << _stat.passed + << "-" << _stat.failed + << "~" << _stat.skipped << "/" << _stat.total << ") ***" << endl; } -test_suite::test_case_type test_suite::add( test_suite::func_type f ) +test_suite::test_case_type test_suite::add( test_suite::func_type f, const string& name ) { vertex_t v = add_vertex( white_color, g); add_edge( root, v, g ); _test[v].tc = detail::make_test_case( detail::call( f ) ); _test[v].state = 0; + _test[v].name = name; + ++_stat.total; return v; } -test_suite::test_case_type test_suite::add( test_suite::func_type f, test_suite::test_case_type depends ) +test_suite::test_case_type test_suite::add( test_suite::func_type f, const string& name, test_suite::test_case_type depends ) { vertex_t v = add_vertex( white_color, g); add_edge( depends, v, g ); _test[v].tc = detail::make_test_case( detail::call( f ) ); _test[v].state = 0; + _test[v].name = name; + ++_stat.total; return v; } @@ -164,13 +208,26 @@ { try { if ( _test[v].state == 0 ) { - if ( (*_test[v].tc)() != 0 ) { + int res = (*_test[v].tc)(); + if ( (res & init) != 0 ) { + // do nothing + } else if ( res == 0 ) { + ++_stat.passed; + cerr << " PASS " << _test[v].name << "\n"; + } else { _test[v].state = fail; + ++_stat.failed; + cerr << " FAIL " << _test[v].name << "\n"; } + } else { + ++_stat.skipped; + cerr << " SKIP " << _test[v].name << "\n"; } } catch ( ... ) { + ++_stat.failed; _test[v].state = fail; + cerr << " FAIL " << _test[v].name << "\n"; } } Modified: trunk/complement/explore/app/exam/suite.h =================================================================== --- trunk/complement/explore/app/exam/suite.h 2007-07-11 18:52:43 UTC (rev 1604) +++ trunk/complement/explore/app/exam/suite.h 2007-07-11 19:56:54 UTC (rev 1605) @@ -7,6 +7,7 @@ #include <sstream> #include <map> #include <boost/graph/adjacency_list.hpp> +#include <string> enum vertex_testcase_t { vertex_testcase }; @@ -141,18 +142,27 @@ typedef int (*func_type)(); typedef vertex_t test_case_type; - test_suite(); + test_suite( const std::string& name ); + test_suite( const char *name ); ~test_suite(); - test_case_type add( func_type ); - test_case_type add( func_type, test_case_type ); + test_case_type add( func_type, const std::string& name ); + test_case_type add( func_type, const std::string& name, test_case_type ); template <class TC> - test_case_type add( int (TC::*)(), TC& ); + test_case_type add( int (TC::*)(), TC&, const std::string& name ); template <class TC> - test_case_type add( int (TC::*)(), TC&, test_case_type ); + test_case_type add( int (TC::*)(), TC&, const std::string& name, test_case_type ); + struct stat + { + int total; + int passed; + int failed; + int skipped; + }; + void girdle(); void girdle( test_case_type start ); @@ -160,7 +170,8 @@ void check_test_case( vertex_t u, vertex_t v ); enum { - trace = 1 + trace = 1, + trace_suite = 2 }; static int flags(); @@ -170,7 +181,8 @@ private: enum { fail = 1, - skip = 2 + skip = 2, + init = 1024 }; graph_t g; @@ -182,33 +194,41 @@ { detail::test_case *tc; int state; + std::string name; }; typedef std::map<vertex_t,test_case_collect> test_case_map_type; test_case_map_type _test; + test_suite::stat _stat; + std::string _suite_name; static int _flags; static void (*_report)( const char *, int, bool, const char * ); + static int _root_func(); }; template <class TC> -test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance ) +test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, const std::string& name ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( root, v, g ); _test[v].tc = detail::make_test_case( f, instance ); _test[v].state = 0; + _test[v].name = name; + ++_stat.total; return v; } template <class TC> -test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, test_suite::test_case_type depends ) +test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, const std::string& name, test_suite::test_case_type depends ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( depends, v, g ); _test[v].tc = detail::make_test_case( f, instance ); _test[v].state = 0; + _test[v].name = name; + ++_stat.total; return v; } Modified: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc 2007-07-11 18:52:43 UTC (rev 1604) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-11 19:56:54 UTC (rev 1605) @@ -9,6 +9,13 @@ return 0; } +int func2() +{ + EXAM_CHECK(true); + + return 0; +} + class test_x { public: @@ -24,15 +31,19 @@ int main( int argc, char **argv ) { - exam::test_suite t; + exam::test_suite t( "exam level 0" ); test_x tx; - t.add( func ); - t.add( &test_x::f, tx ); + t.add( func, "simple function" ); + t.add( &test_x::f, tx, "member function" ); - t.girdle( 0 ); + t.add( func, "simple function, depends", + t.add( &test_x::f, tx, "member function, depends", + t.add( func2, "simple good function" ) ) ); + t.girdle(); + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-16 14:00:52
|
Revision: 1612 http://svn.sourceforge.net/complement/?rev=1612&view=rev Author: complement Date: 2007-07-16 07:00:18 -0700 (Mon, 16 Jul 2007) Log Message: ----------- self test established Modified Paths: -------------- trunk/complement/explore/app/exam/Makefile.inc trunk/complement/explore/app/exam/suite.cc trunk/complement/explore/app/exam/suite.h trunk/complement/explore/app/exam/zero.cc Added Paths: ----------- trunk/complement/explore/app/exam/dummy_test.cc trunk/complement/explore/app/exam/exam_test_suite.cc trunk/complement/explore/app/exam/exam_test_suite.h trunk/complement/explore/app/exam/logger.cc trunk/complement/explore/app/exam/logger.h Modified: trunk/complement/explore/app/exam/Makefile.inc =================================================================== --- trunk/complement/explore/app/exam/Makefile.inc 2007-07-12 07:33:00 UTC (rev 1611) +++ trunk/complement/explore/app/exam/Makefile.inc 2007-07-16 14:00:18 UTC (rev 1612) @@ -1,4 +1,4 @@ # -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> PRGNAME = zero -SRC_CC = zero.cc suite.cc +SRC_CC = zero.cc suite.cc logger.cc exam_test_suite.cc Added: trunk/complement/explore/app/exam/dummy_test.cc =================================================================== --- trunk/complement/explore/app/exam/dummy_test.cc (rev 0) +++ trunk/complement/explore/app/exam/dummy_test.cc 2007-07-16 14:00:18 UTC (rev 1612) @@ -0,0 +1,36 @@ +#include "suite.h" + +int EXAM_IMPL(func) +{ + EXAM_CHECK(false); + + return EXAM_RESULT; +} + +class test_x +{ + public: + + int EXAM_IMPL(f) + { + EXAM_CHECK(false); + EXAM_CHECK(true); + + return EXAM_RESULT; + } + + int EXAM_IMPL(f_good) + { + EXAM_CHECK(true); + EXAM_CHECK(true); + + return EXAM_RESULT; + } +}; + +int EXAM_IMPL(func_good) +{ + EXAM_CHECK(true); + + return EXAM_RESULT; +} Added: trunk/complement/explore/app/exam/exam_test_suite.cc =================================================================== --- trunk/complement/explore/app/exam/exam_test_suite.cc (rev 0) +++ trunk/complement/explore/app/exam/exam_test_suite.cc 2007-07-16 14:00:18 UTC (rev 1612) @@ -0,0 +1,239 @@ +// -*- C++ -*- Time-stamp: <07/07/16 16:33:17 ptr> + +#include "exam_test_suite.h" + +#include "dummy_test.cc" + +int EXAM_IMPL(exam_basic_test::function_good) +{ + buff.str( "" ); + buff.clear(); + + exam::test_suite t( "exam self test, good function" ); + t.set_logger( &logger ); + + test_x tx; + t.add( func_good, "function" ); + t.add( &test_x::f_good, tx, "member function" ); + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r0 ); + + // std::cerr << "%%%\n"; + // std::cerr << buff.str() << std::endl; + // std::cerr << "%%%\n"; + + return EXAM_RESULT; +} + +int EXAM_IMPL(exam_basic_test::function) +{ + buff.str( "" ); + buff.clear(); + + exam::test_suite t( "exam self test, fail function" ); + t.set_logger( &logger ); + + test_x tx; + t.add( func, "function" ); + t.add( &test_x::f, tx, "member function" ); + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r1 ); + + // std::cerr << "%%%\n"; + // std::cerr << buff.str() << std::endl; + // std::cerr << "%%%\n"; + + return EXAM_RESULT; +} + +int EXAM_IMPL(exam_basic_test::dep) +{ + buff.str( "" ); + buff.clear(); + + exam::test_suite t( "exam self test, fail function" ); + t.set_logger( &logger ); + + test_x tx; + t.add( func_good, "function good", // "child" + t.add( &test_x::f_good, tx, "member function good" ) ); // "parent" + t.add( func, "function fail", // <- skiped, because depends upon failed (next line) + t.add( &test_x::f, tx, "member function fail" ) ); // <- fail + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r2 ); + + // std::cerr << "%%%\n"; + // std::cerr << buff.str() << std::endl; + // std::cerr << "%%%\n"; + + return EXAM_RESULT; +} + +int EXAM_IMPL(exam_basic_test::trace) +{ + buff.str( "" ); + buff.clear(); + + exam::test_suite t( "exam self test, fail function" ); + t.set_logger( &logger ); + + logger.flags( exam::base_logger::trace_suite ); + + test_x tx; + t.add( func_good, "function good", // "child" + t.add( &test_x::f_good, tx, "member function good" ) ); // "parent" + t.add( func, "function fail", // <- skiped, because depends upon failed (next line) + t.add( &test_x::f, tx, "member function fail" ) ); // <- fail + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r3 ); + + buff.str( "" ); + buff.clear(); + + logger.flags( exam::base_logger::silent ); + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r4 ); + + buff.str( "" ); + buff.clear(); + + logger.flags( exam::base_logger::trace ); + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r5 ); + + buff.str( "" ); + buff.clear(); + + logger.flags( exam::base_logger::verbose ); + + t.girdle(); + + logger.flags( 0 ); + + EXAM_REQUIRE( buff.str() == r6 ); + + // std::cerr << "%%%\n"; + // std::cerr << buff.str() << std::endl; + // std::cerr << "%%%\n"; + + return EXAM_RESULT; +} + +int EXAM_IMPL(exam_basic_test::dep_test_suite) +{ + buff.str( "" ); + buff.clear(); + + exam::test_suite t0( "exam self test, test suite master" ); + t0.set_logger( &logger ); + + test_x tx0; + t0.add( func_good, "function" ); + t0.add( &test_x::f_good, tx0, "member function" ); + + exam::test_suite t1( "exam self test, test suite slave" ); + t1.set_logger( &logger ); + + test_x tx1; + t1.add( func_good, "function good", // "child" + t1.add( &test_x::f_good, tx1, "member function good" ) ); // "parent" + t1.add( func, "function fail", // <- skiped, because depends upon failed (next line) + t1.add( &test_x::f, tx1, "member function fail" ) ); // <- fail + + exam::test_suite t( "exam self test, test suites dependency" ); + t.set_logger( &logger ); + + t.add( &exam::test_suite::run, t1, "slave test suite", + t.add( &exam::test_suite::run, t0, "master test suite" ) ); + + t.girdle(); + + EXAM_REQUIRE( buff.str() == r7 ); + + // std::cerr << "%%%\n"; + // std::cerr << buff.str() << std::endl; + // std::cerr << "%%%\n"; + + return EXAM_RESULT; +} + +const std::string exam_basic_test::r0 = "\ +*** PASS exam self test, good function (+2-0~0/2) ***\n"; + +const std::string exam_basic_test::r1 = "\ +dummy_test.cc:5: fail: false\n\ + FAIL function\n\ +dummy_test.cc:16: fail: false\n\ + FAIL member function\n\ +*** FAIL exam self test, fail function (+0-2~0/2) ***\n"; + +const std::string exam_basic_test::r2 = "\ +dummy_test.cc:16: fail: false\n\ + FAIL member function fail\n\ + SKIP function fail\n\ +*** FAIL exam self test, fail function (+2-1~1/4) ***\n"; + +const std::string exam_basic_test::r3 = "\ +== Begin test suite\n\ +dummy_test.cc:16: fail: false\n\ + FAIL member function fail\n\ + SKIP function fail\n\ +== End test suite\n\ +*** FAIL exam self test, fail function (+2-1~1/4) ***\n"; + +const std::string exam_basic_test::r4 = "\ +*** FAIL exam self test, fail function (+2-1~1/4) ***\n"; + +const std::string exam_basic_test::r5 = "\ +dummy_test.cc:24: pass: true\n\ +dummy_test.cc:25: pass: true\n\ +dummy_test.cc:16: fail: false\n\ +dummy_test.cc:17: pass: true\n\ + FAIL member function fail\n\ + SKIP function fail\n\ +dummy_test.cc:33: pass: true\n\ +*** FAIL exam self test, fail function (+2-1~1/4) ***\n"; + +const std::string exam_basic_test::r6 = "\ + PASS member function good\n\ +dummy_test.cc:16: fail: false\n\ + FAIL member function fail\n\ + SKIP function fail\n\ + PASS function good\n\ +*** FAIL exam self test, fail function (+2-1~1/4) ***\n"; + +const std::string exam_basic_test::r7 = "\ +*** PASS exam self test, test suite master (+2-0~0/2) ***\n\ +dummy_test.cc:16: fail: false\n\ + FAIL member function fail\n\ + SKIP function fail\n\ +*** FAIL exam self test, test suite slave (+2-1~1/4) ***\n\ + FAIL slave test suite\n\ +*** FAIL exam self test, test suites dependency (+1-1~0/2) ***\n"; + +int EXAM_IMPL(exam_self_test) +{ + exam::test_suite t( "exam self test" ); + exam_basic_test exam_basic; + + t.add( &exam_basic_test::function_good, exam_basic, "call test, good calls" ); + t.add( &exam_basic_test::function, exam_basic, "call test, fail calls" ); + exam::test_suite::test_case_type d = t.add( &exam_basic_test::dep, exam_basic, "call test, tests dependency" ); + t.add( &exam_basic_test::trace, exam_basic, "trace flags test", d ); + t.add( &exam_basic_test::dep_test_suite, exam_basic, "test suites grouping", d ); + + return t.girdle(); +} + Added: trunk/complement/explore/app/exam/exam_test_suite.h =================================================================== --- trunk/complement/explore/app/exam/exam_test_suite.h (rev 0) +++ trunk/complement/explore/app/exam/exam_test_suite.h 2007-07-16 14:00:18 UTC (rev 1612) @@ -0,0 +1,42 @@ +// -*- C++ -*- Time-stamp: <07/07/16 16:33:17 ptr> + +#ifndef __exam_test_suite_h +#define __exam_test_suite_h + +#define FIT_EXAM + +#include "suite.h" +#include <string> +#include <sstream> + +class exam_basic_test +{ + public: + exam_basic_test() : + buff(), + logger( buff ) + { } + + int EXAM_DECL(function_good); + int EXAM_DECL(function); + int EXAM_DECL(dep); + int EXAM_DECL(trace); + int EXAM_DECL(dep_test_suite); + + private: + std::stringstream buff; + exam::trivial_logger logger; + + static const std::string r0; + static const std::string r1; + static const std::string r2; + static const std::string r3; + static const std::string r4; + static const std::string r5; + static const std::string r6; + static const std::string r7; +}; + +int EXAM_DECL(exam_self_test); + +#endif // __exam_test_suite_h Added: trunk/complement/explore/app/exam/logger.cc =================================================================== --- trunk/complement/explore/app/exam/logger.cc (rev 0) +++ trunk/complement/explore/app/exam/logger.cc 2007-07-16 14:00:18 UTC (rev 1612) @@ -0,0 +1,111 @@ +// -*- C++ -*- Time-stamp: <07/07/13 10:53:32 ptr> + +#include "logger.h" +#include <iostream> + +namespace exam { + +using namespace std; + +int base_logger::flags() const +{ + return _flags; +} + +bool base_logger::is_trace() const +{ + return (_flags & trace) != 0; +} + +int base_logger::flags( int f ) +{ + int tmp = _flags; + _flags = f; + if ( (f & silent) != 0 ) { + _flags &= ~trace_suite; + } + return tmp; +} + +void trivial_logger::report( const char *file, int line, bool cnd, const char *expr ) +{ + if ( (cnd && ((_flags & trace) == 0)) || ((_flags & silent) != 0) ) { + return; + } + + if ( s != 0 ) { + *s << file << ":" << line << ": " << (cnd ? "pass" : "fail" ) << ": " << expr + << std::endl; + } else { + fprintf( f, "%s:%d: %s: %s\n", file, line, (cnd ? "pass" : "fail" ), expr ); + } +} + +void trivial_logger::begin_ts() +{ + if ( (_flags & trace_suite) == 0 ) { + return; + } + + if ( s != 0 ) { + *s << "== Begin test suite\n"; + } else { + fprintf( f, "== Begin test suite\n" ); + } +} + +void trivial_logger::end_ts() +{ + if ( (_flags & trace_suite) == 0 ) { + return; + } + + if ( *s ) { + *s << "== End test suite\n"; + } else { + fprintf( f, "== End test suite\n" ); + } +} + +void trivial_logger::result( const base_logger::stat& _stat, const string& suite_name ) +{ + if ( s != 0 ) { + *s << "*** " << (_stat.failed != 0 ? "FAIL " : "PASS " ) << suite_name + << " (+" << _stat.passed + << "-" << _stat.failed + << "~" << _stat.skipped << "/" << _stat.total << ") ***" << endl; + } else { + fprintf( f, "*** %s (+%d-%d~%d/%d) ***\n", (_stat.failed != 0 ? "FAIL" : "PASS" ), _stat.passed, _stat.failed, _stat.skipped, _stat.total ); + } +} + +void trivial_logger::tc( base_logger::tc_result r, const std::string& name ) +{ + if ( ((_flags & silent) != 0) || ((r == pass) && ((_flags & verbose) == 0) )) { + return; + } + + static const char *m[] = { " PASS ", " FAIL ", " SKIP " }; + const char *rs = ""; + + switch ( r ) + { + case pass: + rs = m[0]; + break; + case fail: + rs = m[1]; + break; + case skip: + rs = m[2]; + break; + } + + if ( s != 0 ) { + *s << rs << name << endl; + } else { + fprintf( f, "%s%s\n", rs, name.c_str() ); + } +} + +} //namespace exam Added: trunk/complement/explore/app/exam/logger.h =================================================================== --- trunk/complement/explore/app/exam/logger.h (rev 0) +++ trunk/complement/explore/app/exam/logger.h 2007-07-16 14:00:18 UTC (rev 1612) @@ -0,0 +1,94 @@ +// -*- C++ -*- Time-stamp: <07/07/13 11:01:52 ptr> + +#ifndef __logger_h +#define __logger_h + +#include <string> +#include <cstdio> +#include <ostream> + +namespace exam { + +class base_logger +{ + public: + + enum trace_flags { + trace = 1, + trace_suite = 2, + silent = 4, + verbose = 8 + }; + + enum tc_result { + pass = 0, + fail, + skip + }; + + struct stat + { + stat() : + total(0), + passed(0), + failed(0), + skipped(0) + { } + + int total; + int passed; + int failed; + int skipped; + }; + + base_logger() : + _flags( 0 ) + { } + virtual ~base_logger() + { } + + int flags() const; + bool is_trace() const; + + int flags( int ); + + virtual void report( const char *, int, bool, const char * ) = 0; + + virtual void begin_ts() = 0; + virtual void end_ts() = 0; + virtual void result( const base_logger::stat&, const std::string& suite_name ) = 0; + virtual void tc( tc_result, const std::string& ) = 0; + + protected: + int _flags; +}; + +class trivial_logger : + public base_logger +{ + public: + explicit trivial_logger( std::ostream& str ) : + s( &str ), + f( 0 ) + { } + + explicit trivial_logger( FILE *fs ) : + s( 0 ), + f( fs ) + { } + + virtual void report( const char *, int, bool, const char * ); + + virtual void begin_ts(); + virtual void end_ts(); + virtual void result( const base_logger::stat&, const std::string& ); + virtual void tc( base_logger::tc_result, const std::string& ); + + private: + std::ostream *s; + FILE *f; +}; + +} // namespace exam + +#endif // __logger_h Modified: trunk/complement/explore/app/exam/suite.cc =================================================================== --- trunk/complement/explore/app/exam/suite.cc 2007-07-12 07:33:00 UTC (rev 1611) +++ trunk/complement/explore/app/exam/suite.cc 2007-07-16 14:00:18 UTC (rev 1612) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 11:10:45 ptr> +// -*- C++ -*- Time-stamp: <07/07/15 16:33:03 ptr> #include "suite.h" #include <boost/graph/breadth_first_search.hpp> @@ -61,39 +61,59 @@ skip_recorder<Tag> record_skip(test_suite& ts, Tag) { return skip_recorder<Tag>(ts); } +template <class Tag> +struct white_recorder : + public base_visitor<white_recorder<Tag> > +{ + typedef Tag event_filter; + + white_recorder(test_suite& ts) : + _suite(ts) + { } + + template <class Vertex, class Graph> + void operator()(Vertex v, const Graph& g) + { + // std::cerr << "On vertex " << v << std::endl; + // boost::put( boost::vertex_color, g, v, white_color ); + _suite.clean_test_case_state( v ); + } + + test_suite& _suite; +}; + +template <class Tag> +white_recorder<Tag> record_white(test_suite& ts, Tag) +{ return white_recorder<Tag>(ts); } + + } // namespace detail -int test_suite::_root_func() +int EXAM_IMPL(test_suite::_root_func) { - return test_suite::init; + throw init_exception(); + + return -1; } test_suite::test_suite( const string& name ) : root( add_vertex( white_color, g ) ), - _suite_name( name ) + _suite_name( name ), + local_logger( logger ) { - color = get( vertex_color, g ); testcase = get( vertex_testcase, g ); _test[root].tc = detail::make_test_case( detail::call( _root_func ) ); _test[root].state = 0; - _stat.total = 0; - _stat.passed = 0; - _stat.failed = 0; - _stat.skipped = 0; } test_suite::test_suite( const char *name ) : root( add_vertex( white_color, g ) ), - _suite_name( name ) + _suite_name( name ), + local_logger( logger ) { - color = get( vertex_color, g ); testcase = get( vertex_testcase, g ); _test[root].tc = detail::make_test_case( detail::call( _root_func ) ); _test[root].state = 0; - _stat.total = 0; - _stat.passed = 0; - _stat.failed = 0; - _stat.skipped = 0; } test_suite::~test_suite() @@ -103,49 +123,34 @@ } } -void test_suite::girdle() +int test_suite::girdle( test_suite::test_case_type start ) { stack<vertex_t> buffer; - cerr << "== Begin test suite\n"; - breadth_first_visit( g, root, buffer, - make_bfs_visitor( - make_pair( record_vertexes(*this,on_discover_vertex()), - record_skip(*this,on_examine_edge()) ) ), - color ); - cerr << "== End test suite\n"; - if ( _stat.failed != 0 ) { - cerr << "*** FAIL "; - } else { - cerr << "*** PASS "; - } - cerr << _suite_name - << " (+" << _stat.passed - << "-" << _stat.failed - << "~" << _stat.skipped << "/" << _stat.total << ") ***" << endl; -} + vertex_color_map_t color = get( vertex_color, g ); -void test_suite::girdle( test_suite::test_case_type start ) -{ - stack<vertex_t> buffer; - cerr << "== Begin test suite\n"; - breadth_first_visit( g, start, buffer, - make_bfs_visitor( - make_pair( record_vertexes(*this,on_discover_vertex()), - record_skip(*this,on_examine_edge()) ) ), - color ); - cerr << "== End test suite\n"; - if ( _stat.failed != 0 ) { - cerr << "*** FAIL "; - } else { - cerr << "*** PASS "; - } - cerr << _suite_name - << " (+" << _stat.passed - << "-" << _stat.failed - << "~" << _stat.skipped << "/" << _stat.total << ") ***" << endl; + // detail::white_recorder<on_initialize_vertex> vis( *this ); + // + // vertex_iterator_t i, i_end; + + // for ( tie(i, i_end) = vertices(g); i != i_end; ++i ) { + // // vis.initialize_vertex( *i, g ); + // put( color, *i, white_color ); + // } + + _stat = base_logger::stat(); + local_logger->begin_ts(); + breadth_first_search( g, start, buffer, + make_bfs_visitor( + make_pair( record_white(*this,on_initialize_vertex()), + make_pair( record_vertexes(*this,on_discover_vertex()), + record_skip(*this,on_examine_edge()) ) ) ), + color ); + local_logger->end_ts(); + local_logger->result( _stat, _suite_name ); + + return _stat.failed; } - test_suite::test_case_type test_suite::add( test_suite::func_type f, const string& name ) { vertex_t v = add_vertex( white_color, g); @@ -153,7 +158,7 @@ _test[v].tc = detail::make_test_case( detail::call( f ) ); _test[v].state = 0; _test[v].name = name; - ++_stat.total; + // ++_stat.total; return v; } @@ -165,69 +170,77 @@ _test[v].tc = detail::make_test_case( detail::call( f ) ); _test[v].state = 0; _test[v].name = name; - ++_stat.total; + // ++_stat.total; return v; } int test_suite::flags() { - return _flags; + return local_logger->flags(); } bool test_suite::is_trace() { - return (_flags & trace) != 0; + return local_logger->is_trace(); } -void _report0( const char *file, int line, bool cnd, const char *expr ) +int test_suite::flags( int f ) { - std::cerr << file << ":" << line << ": " << (cnd ? "pass" : "fail" ) << ": " << expr - << std::endl; + return local_logger->flags( f ); } -void _report1( const char *file, int line, bool cnd, const char *expr ) +trivial_logger __trivial_logger_inst( cerr ); + +base_logger *test_suite::logger = &__trivial_logger_inst; + +base_logger *test_suite::set_global_logger( base_logger *new_logger ) { - printf( "%s:%d: %s: %s\n", file, line, (cnd ? "pass" : "fail"), expr ); + base_logger *tmp = logger; + logger = new_logger; + if ( tmp == local_logger ) { // if local_logger was identical to logger, switch it too + local_logger = logger; + } + return tmp; } -void _report2( const char *file, int line, bool cnd, const char *expr ) +base_logger *test_suite::set_logger( base_logger *new_logger ) { - fprintf( stderr, "%s:%d: %s: %s\n", file, line, (cnd ? "pass" : "fail"), expr ); + base_logger *tmp = local_logger; + local_logger = new_logger; + return tmp; } -int test_suite::_flags = 0; -void (*test_suite::_report)( const char *, int, bool, const char * ) = _report0; - void test_suite::report( const char *file, int line, bool cnd, const char *expr ) { - (*test_suite::_report)( file, line, cnd, expr ); + local_logger->report( file, line, cnd, expr ); } void test_suite::run_test_case( test_suite::vertex_t v ) { try { + ++_stat.total; if ( _test[v].state == 0 ) { - int res = (*_test[v].tc)(); - if ( (res & init) != 0 ) { - // do nothing - } else if ( res == 0 ) { + if ( (*_test[v].tc)( this, 0 ) == 0 ) { ++_stat.passed; - cerr << " PASS " << _test[v].name << "\n"; + local_logger->tc( base_logger::pass, _test[v].name ); } else { _test[v].state = fail; ++_stat.failed; - cerr << " FAIL " << _test[v].name << "\n"; + local_logger->tc( base_logger::fail, _test[v].name ); } } else { ++_stat.skipped; - cerr << " SKIP " << _test[v].name << "\n"; + local_logger->tc( base_logger::skip, _test[v].name ); } } + catch ( init_exception& ) { + --_stat.total; + } catch ( ... ) { ++_stat.failed; _test[v].state = fail; - cerr << " FAIL " << _test[v].name << "\n"; + local_logger->tc( base_logger::fail, _test[v].name ); } } @@ -238,4 +251,15 @@ } } +void test_suite::clean_test_case_state( vertex_t v ) +{ + _test[v].state = 0; +} + +int test_suite::run( test_suite *, int ) +{ + return girdle( root ); +} + + } // namespace exam Modified: trunk/complement/explore/app/exam/suite.h =================================================================== --- trunk/complement/explore/app/exam/suite.h 2007-07-12 07:33:00 UTC (rev 1611) +++ trunk/complement/explore/app/exam/suite.h 2007-07-16 14:00:18 UTC (rev 1612) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 11:02:41 ptr> +// -*- C++ -*- Time-stamp: <07/07/15 16:33:17 ptr> #ifndef __suite_h #define __suite_h @@ -8,7 +8,10 @@ #include <map> #include <boost/graph/adjacency_list.hpp> #include <string> +#include <exception> +#include "logger.h" + enum vertex_testcase_t { vertex_testcase }; namespace boost { @@ -17,13 +20,16 @@ namespace exam { +class test_suite; + namespace detail { struct call_impl { virtual ~call_impl() { } - virtual int invoke() = 0; + // virtual int invoke() = 0; + virtual int invoke( test_suite *, int = 0 ) = 0; }; template <typename F> @@ -35,9 +41,13 @@ _f( f ) { } - virtual int invoke() - { return _f(); } + // virtual int invoke() + // { return _f(); } + virtual int invoke( test_suite *s, int count = 0 ) + { return _f( s, count ); } + + private: F _f; }; @@ -45,8 +55,12 @@ class dummy { public: - virtual int f() - { } + // virtual int f() + // { return 0; } + + virtual int f( test_suite *, int count = 0 ) + { return count; } + private: virtual ~dummy() { } @@ -56,7 +70,8 @@ class method_invoker { public: - typedef int (TC::*mf_type)(); + // typedef int (TC::*mf_type_a)(); + typedef int (TC::*mf_type)( test_suite *, int ); explicit method_invoker( TC& instance, mf_type f ) : _inst(instance), @@ -68,9 +83,12 @@ _func( m._func ) { } - int operator()() - { return (_inst.*_func)(); } + // int operator()() + // { return (_inst.*_func)(); } + int operator()( test_suite *ts, int count = 0 ) + { return (_inst.*_func)( ts, count ); } + private: method_invoker& operator =( const method_invoker<TC>& ) { return *this; } @@ -89,9 +107,12 @@ call( F f ) { new (&_buf[0]) call_impl_t<F>(f); } - int operator()() - { return reinterpret_cast<call_impl *>(&_buf[0])->invoke(); } + // int operator()() + // { return reinterpret_cast<call_impl *>(&_buf[0])->invoke(); } + int operator()( test_suite *ts, int count = 0 ) + { return reinterpret_cast<call_impl *>(&_buf[0])->invoke( ts, count ); } + private: // call_impl *_f; char _buf[((sizeof(call_impl_t<method_invoker<dummy> >)+64) / 64) << 6]; @@ -105,9 +126,12 @@ _tc( f ) { } - int operator ()() - { return _tc(); } + // int operator ()() + // { return _tc(); } + int operator ()( test_suite *ts, int count = 0 ) + { return _tc( ts, count ); } + private: call _tc; }; @@ -118,13 +142,18 @@ } template <class TC> -inline test_case *make_test_case( int (TC::*f)(), TC& instance ) +inline test_case *make_test_case( int (TC::*f)( test_suite *, int ), TC& instance ) { return new test_case( method_invoker<TC>(instance, f) ); } } // namespace detail +class init_exception : + public std::exception +{ +}; + class test_suite { private: @@ -139,7 +168,7 @@ typedef boost::property_map<graph_t,vertex_testcase_t>::type vertex_testcase_map_t; public: - typedef int (*func_type)(); + typedef int (*func_type)( test_suite *, int ); typedef vertex_t test_case_type; test_suite( const std::string& name ); @@ -150,45 +179,38 @@ test_case_type add( func_type, const std::string& name, test_case_type ); template <class TC> - test_case_type add( int (TC::*)(), TC&, const std::string& name ); + test_case_type add( int (TC::*)( test_suite *, int ), TC&, const std::string& name ); template <class TC> - test_case_type add( int (TC::*)(), TC&, const std::string& name, test_case_type ); + test_case_type add( int (TC::*)( test_suite *, int ), TC&, const std::string& name, test_case_type ); - struct stat - { - int total; - int passed; - int failed; - int skipped; - }; + int girdle( test_case_type start ); + int girdle() + { return girdle( root ); } + int run( test_suite *, int count = 0 ); - void girdle(); - void girdle( test_case_type start ); - void run_test_case( vertex_t v ); void check_test_case( vertex_t u, vertex_t v ); + void clean_test_case_state( vertex_t v ); - enum { - trace = 1, - trace_suite = 2 - }; + int flags(); + int flags( int ); + bool is_trace(); + void report( const char *, int, bool, const char * ); + base_logger *set_global_logger( base_logger * ); + base_logger *set_logger( base_logger * ); - static int flags(); - static bool is_trace(); - static void report( const char *, int, bool, const char * ); - private: enum { + pass = 0, fail = 1, - skip = 2, - init = 1024 + skip = 2 }; graph_t g; vertex_t root; - vertex_color_map_t color; vertex_testcase_map_t testcase; + base_logger *local_logger; struct test_case_collect { @@ -199,36 +221,36 @@ typedef std::map<vertex_t,test_case_collect> test_case_map_type; test_case_map_type _test; - test_suite::stat _stat; + base_logger::stat _stat; std::string _suite_name; - static int _flags; - static void (*_report)( const char *, int, bool, const char * ); - static int _root_func(); + static int _root_func( test_suite *, int = 0 ); + + static base_logger *logger; }; template <class TC> -test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, const std::string& name ) +test_suite::test_case_type test_suite::add( int (TC::*f)( test_suite *, int ), TC& instance, const std::string& name ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( root, v, g ); _test[v].tc = detail::make_test_case( f, instance ); _test[v].state = 0; _test[v].name = name; - ++_stat.total; + // ++_stat.total; return v; } template <class TC> -test_suite::test_case_type test_suite::add( int (TC::*f)(), TC& instance, const std::string& name, test_suite::test_case_type depends ) +test_suite::test_case_type test_suite::add( int (TC::*f)( test_suite *, int ), TC& instance, const std::string& name, test_suite::test_case_type depends ) { vertex_t v = boost::add_vertex( boost::white_color, g); boost::add_edge( depends, v, g ); _test[v].tc = detail::make_test_case( f, instance ); _test[v].state = 0; _test[v].name = name; - ++_stat.total; + // ++_stat.total; return v; } @@ -238,11 +260,23 @@ } // namespace exam #ifdef FIT_EXAM -# define EXAM_CHECK(C) if ( !(C) ) { exam::test_suite::report( __FILE__, __LINE__, false, #C ); return 1; } else if ( exam::test_suite::is_trace() ) { exam::test_suite::report( __FILE__, __LINE__, true, #C ); } -# define EXAM_MESSAGE(M) +# define EXAM_IMPL(F) F( exam::test_suite *__exam_ts, int __exam_counter ) +# define EXAM_DECL(F) F( exam::test_suite *, int = 0 ) +# define EXAM_RESULT __exam_counter +# define EXAM_CHECK(C) if ( !(C) ) { __exam_ts->report( __FILE__, __LINE__, false, #C ); __exam_counter |= 1; } else __exam_ts->report( __FILE__, __LINE__, true, #C ) +# define EXAM_MESSAGE(M) __exam_ts->report( __FILE__, __LINE__, true, M ) +# define EXAM_REQUIRE(C) if ( !(C) ) { __exam_ts->report( __FILE__, __LINE__, false, #C ); return 1; } else __exam_ts->report( __FILE__, __LINE__, true, #C ) +# define EXAM_FAIL(M) __exam_ts->report( __FILE__, __LINE__, false, M ); return 1 +# define EXAM_ERROR(M) __exam_ts->report( __FILE__, __LINE__, false, M ); __exam_counter |= 1 #else +# define EXAM_IMPL(F) F( exam::test_suite *, int ) +# define EXAM_DECL(F) F( exam::test_suite *, int = 0 ) +# define EXAM_RESULT 0 # define EXAM_CHECK(C) # define EXAM_MESSAGE(M) +# define EXAM_REQUIRE(C) +# define EXAM_FAIL(M) +# define EXAM_ERROR(M) #endif Modified: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc 2007-07-12 07:33:00 UTC (rev 1611) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-16 14:00:18 UTC (rev 1612) @@ -1,49 +1,14 @@ -#define FIT_EXAM +// -*- C++ -*- Time-stamp: <07/07/16 16:33:17 ptr> -#include "suite.h" +#include "exam_test_suite.h" -int func() +int main( int, char ** ) { - EXAM_CHECK(false); + // exam::test_suite t( "exam self test" ); + // t.add( exam_self_test, "exam self test suite" ); + // + // return t.girdle(); - return 0; + return exam_self_test(0); } -int func2() -{ - EXAM_CHECK(true); - - return 0; -} - -class test_x -{ - public: - - int f() - { - EXAM_CHECK(false); - - return 0; - } -}; - - -int main( int argc, char **argv ) -{ - exam::test_suite t( "exam level 0" ); - - test_x tx; - - t.add( func, "simple function" ); - t.add( &test_x::f, tx, "member function" ); - - t.add( func, "simple function, depends", - t.add( &test_x::f, tx, "member function, depends", - t.add( func2, "simple good function" ) ) ); - - t.girdle(); - - return 0; -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-16 14:04:41
|
Revision: 1613 http://svn.sourceforge.net/complement/?rev=1613&view=rev Author: complement Date: 2007-07-16 07:04:06 -0700 (Mon, 16 Jul 2007) Log Message: ----------- rename main guard Modified Paths: -------------- trunk/complement/explore/app/exam/Makefile.inc Added Paths: ----------- trunk/complement/explore/app/exam/exam_self_test.cc Removed Paths: ------------- trunk/complement/explore/app/exam/zero.cc Modified: trunk/complement/explore/app/exam/Makefile.inc =================================================================== --- trunk/complement/explore/app/exam/Makefile.inc 2007-07-16 14:00:18 UTC (rev 1612) +++ trunk/complement/explore/app/exam/Makefile.inc 2007-07-16 14:04:06 UTC (rev 1613) @@ -1,4 +1,4 @@ # -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> -PRGNAME = zero -SRC_CC = zero.cc suite.cc logger.cc exam_test_suite.cc +PRGNAME = exam_self_test +SRC_CC = exam_self_test.cc suite.cc logger.cc exam_test_suite.cc Copied: trunk/complement/explore/app/exam/exam_self_test.cc (from rev 1612, trunk/complement/explore/app/exam/zero.cc) =================================================================== --- trunk/complement/explore/app/exam/exam_self_test.cc (rev 0) +++ trunk/complement/explore/app/exam/exam_self_test.cc 2007-07-16 14:04:06 UTC (rev 1613) @@ -0,0 +1,14 @@ +// -*- C++ -*- Time-stamp: <07/07/16 16:33:17 ptr> + +#include "exam_test_suite.h" + +int main( int, char ** ) +{ + // exam::test_suite t( "exam self test" ); + // t.add( exam_self_test, "exam self test suite" ); + // + // return t.girdle(); + + return exam_self_test(0); +} + Deleted: trunk/complement/explore/app/exam/zero.cc =================================================================== --- trunk/complement/explore/app/exam/zero.cc 2007-07-16 14:00:18 UTC (rev 1612) +++ trunk/complement/explore/app/exam/zero.cc 2007-07-16 14:04:06 UTC (rev 1613) @@ -1,14 +0,0 @@ -// -*- C++ -*- Time-stamp: <07/07/16 16:33:17 ptr> - -#include "exam_test_suite.h" - -int main( int, char ** ) -{ - // exam::test_suite t( "exam self test" ); - // t.add( exam_self_test, "exam self test suite" ); - // - // return t.girdle(); - - return exam_self_test(0); -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |