1 /* $Id: test_filter2.cpp,v 1.9 2005-10-15 14:09:09 adam Exp $
2 Copyright (c) 2005, Index Data.
11 #include "package.hpp"
15 #define BOOST_AUTO_TEST_MAIN
16 #include <boost/test/auto_unit_test.hpp>
18 using namespace boost::unit_test;
21 class FilterConstant: public yp2::filter::Base {
23 void process(yp2::Package & package) const {
24 package.data() = 1234;
30 class FilterDouble: public yp2::filter::Base {
32 void process(yp2::Package & package) const {
33 package.data() = package.data() * 2;
39 BOOST_AUTO_TEST_CASE( testfilter2 )
43 fc.name() = "FilterConstant";
45 fd.name() = "FilterDouble";
48 yp2::RouterChain router1;
50 // test filter set/get/exception
57 yp2::Package pack(session, origin);
59 pack.router(router1).move();
61 BOOST_CHECK (pack.data() == 2468);
66 yp2::RouterChain router2;
73 yp2::Package pack(session, origin);
75 pack.router(router2).move();
77 BOOST_CHECK (pack.data() == 1234);
82 catch (std::exception &e) {
83 std::cout << e.what() << "\n";
95 * indent-tabs-mode: nil
96 * c-file-style: "stroustrup"
98 * vim: shiftwidth=4 tabstop=8 expandtab