From: Marc Cromme Date: Fri, 7 Oct 2005 22:46:16 +0000 (+0000) Subject: added doxygen make target X-Git-Tag: YP2.0.0.2~241 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=a9b81d72b554d21849c7f25ac0faf487637fde58;p=metaproxy-moved-to-github.git added doxygen make target unit tests ported to boost test framework --- diff --git a/Makefile.am b/Makefile.am index 6ff4987..f718183 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,5 +7,6 @@ EXTRA_DIST= m4/yazpp.m4 m4/yaz.m4 buildconf.sh MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure # doxygen target +.PHONY:dox dox: doxygen diff --git a/src/Makefile.am b/src/Makefile.am index 23198ab..7ebc614 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.10 2005-10-07 21:38:24 marc Exp $ +## $Id: Makefile.am,v 1.11 2005-10-07 22:46:16 marc Exp $ MAINTAINERCLEANFILES = Makefile.in config.in config.hpp @@ -32,6 +32,8 @@ p2_SOURCES=p2_frontend.cpp p2_msg.cpp p2.cpp p2_frontend.h \ LDADD= $(YAZPPLALIB) $(XSLT_LIBS) test_filter1_LDADD = $(LDADD) -lboost_unit_test_framework +test_filter2_LDADD = $(LDADD) -lboost_unit_test_framework +test_session1_LDADD = $(LDADD) -lboost_unit_test_framework test_boost_threads_LDADD = $(LDADD) -lboost_unit_test_framework diff --git a/src/test_filter1.cpp b/src/test_filter1.cpp index 1d1b02b..d1142a2 100644 --- a/src/test_filter1.cpp +++ b/src/test_filter1.cpp @@ -1,16 +1,12 @@ #include #include + #include "filter.hpp" -//#include "router.hpp" -//#include "package.hpp" #define BOOST_AUTO_TEST_MAIN #include -//#include -//#include - using namespace boost::unit_test; class TFilter: public yp2::Filter { @@ -21,7 +17,7 @@ public: }; -BOOST_AUTO_TEST_CASE( test1 ) +BOOST_AUTO_TEST_CASE( test_filter1 ) { try{ TFilter filter; @@ -34,10 +30,10 @@ BOOST_AUTO_TEST_CASE( test1 ) BOOST_CHECK(filter.name() == "filter1 rename"); } - catch(std::runtime_error &e ){ - BOOST_CHECK (true); - } - catch ( ...) { + //catch(std::runtime_error &e ){ + // BOOST_CHECK (true); + //} + catch ( ... ) { BOOST_CHECK (false); } } diff --git a/src/test_filter2.cpp b/src/test_filter2.cpp index ff98627..f26e6e6 100644 --- a/src/test_filter2.cpp +++ b/src/test_filter2.cpp @@ -1,14 +1,21 @@ -#include -//#include "design.h" + + #include "filter.hpp" #include "router.hpp" #include "package.hpp" +#include + +#define BOOST_AUTO_TEST_MAIN +#include + +using namespace boost::unit_test; + + class FilterConstant: public yp2::Filter { public: yp2::Package & process(yp2::Package & package) const { - std::cout << name() + ".process()" << std::endl; package.data() = 1234; return package.move(); }; @@ -18,14 +25,13 @@ public: class FilterDouble: public yp2::Filter { public: yp2::Package & process(yp2::Package & package) const { - std::cout << name() + ".process()" << std::endl; package.data() = package.data() * 2; return package.move(); }; }; -int main(int argc, char **argv) +BOOST_AUTO_TEST_CASE( testfilter2 ) { try { FilterConstant fc; @@ -47,35 +53,36 @@ int main(int argc, char **argv) pack_out = pack_in.router(router1).move(); - if (pack_out.data() != 2468) - { - exit(1); - } - } - { - yp2::RouterChain router1; + BOOST_CHECK (pack_out.data() == 2468); + + } + + { + + yp2::RouterChain router2; - router1.rule(fd); - router1.rule(fc); + router2.rule(fd); + router2.rule(fc); yp2::Package pack_in; yp2::Package pack_out; - pack_out = pack_in.router(router1).move(); - - if (pack_out.data() != 1234) - { - exit(1); - } + pack_out = pack_in.router(router2).move(); + + BOOST_CHECK (pack_out.data() == 1234); + } } catch (std::exception &e) { std::cout << e.what() << "\n"; - exit(1); + BOOST_CHECK (false); } - exit(0); + catch ( ...) { + BOOST_CHECK (false); + } + } /* diff --git a/src/test_session1.cpp b/src/test_session1.cpp index 47b4d01..58ec655 100644 --- a/src/test_session1.cpp +++ b/src/test_session1.cpp @@ -1,37 +1,40 @@ +#include "session.hpp" #include -//#include "filter.hpp" -//#include "router.hpp" -//#include "package.hpp" -#include "session.hpp" +#define BOOST_AUTO_TEST_MAIN +#include - -int main(int argc, char **argv) +using namespace boost::unit_test; + +BOOST_AUTO_TEST_CASE( testsession1 ) { + // test session try { yp2::Session session; unsigned long int id; id = session.id(); - std::cout << "Session.id() == " << id << std::endl; id = session.id(); - std::cout << "Session.id() == " << id << std::endl; id = session.id(); - std::cout << "Session.id() == " << id << std::endl; + id = session.id(); + id = session.id(); + id = session.id(); + id = session.id(); + id = session.id(); + id = session.id(); + id = session.id(); - if (id != 3) - { - std::cout << "Fail: Session.id() != 3\n"; - exit(1); - } + BOOST_CHECK (id == 10); + } - catch (std::exception &e) { std::cout << e.what() << "\n"; - exit(1); + BOOST_CHECK (false); + } + catch (...) { + BOOST_CHECK (false); } - exit(0); } /*