MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure
# doxygen target
+.PHONY:dox
dox:
doxygen
-## $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
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
#include <iostream>
#include <stdexcept>
+
#include "filter.hpp"
-//#include "router.hpp"
-//#include "package.hpp"
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
-//#include <boost/test/unit_test.hpp>
-//#include <boost/test/unit_test_monitor.hpp>
-
using namespace boost::unit_test;
class TFilter: public yp2::Filter {
};
-BOOST_AUTO_TEST_CASE( test1 )
+BOOST_AUTO_TEST_CASE( test_filter1 )
{
try{
TFilter filter;
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);
}
}
-#include <iostream>
-//#include "design.h"
+
+
#include "filter.hpp"
#include "router.hpp"
#include "package.hpp"
+#include <iostream>
+
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
+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();
};
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;
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);
+ }
+
}
/*
+#include "session.hpp"
#include <iostream>
-//#include "filter.hpp"
-//#include "router.hpp"
-//#include "package.hpp"
-#include "session.hpp"
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
-
-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);
}
/*