1 /* $Id: test_filter_factory.cpp,v 1.6 2005-12-02 12:21:07 adam Exp $
2 Copyright (c) 2005, Index Data.
14 #include "filter_factory.hpp"
17 #define BOOST_AUTO_TEST_MAIN
18 #include <boost/test/auto_unit_test.hpp>
20 using namespace boost::unit_test;
22 class XFilter: public yp2::filter::Base {
24 void process(yp2::Package & package) const {};
28 yp2::filter::Base* xfilter_creator(){
32 class YFilter: public yp2::filter::Base {
34 void process(yp2::Package & package) const {};
37 yp2::filter::Base* yfilter_creator(){
42 BOOST_AUTO_UNIT_TEST( test_filter_factory_1 )
46 yp2::FilterFactory ffactory;
51 const std::string xfid = "XFilter";
52 const std::string yfid = "YFilter";
54 //std::cout << "Xfilter name: " << xfid << std::endl;
55 //std::cout << "Yfilter name: " << yfid << std::endl;
57 BOOST_CHECK_EQUAL(ffactory.add_creator(xfid, xfilter_creator),
59 BOOST_CHECK_EQUAL(ffactory.drop_creator(xfid),
61 BOOST_CHECK_EQUAL(ffactory.add_creator(xfid, xfilter_creator),
63 BOOST_CHECK_EQUAL(ffactory.add_creator(yfid, yfilter_creator),
66 yp2::filter::Base* xfilter = 0;
67 xfilter = ffactory.create(xfid);
68 yp2::filter::Base* yfilter = 0;
69 yfilter = ffactory.create(yfid);
71 //BOOST_CHECK_EQUAL(sizeof(xf), sizeof(*xfilter));
72 //BOOST_CHECK_EQUAL(sizeof(yf), sizeof(*yfilter));
74 BOOST_CHECK(0 != xfilter);
75 BOOST_CHECK(0 != yfilter);
85 // get function - right val in assignment
86 //std::string name() const {
91 // set function - left val in assignment
92 //std::string & name() {
96 // set function - can be chained
97 //Base & name(const std::string & name){
106 * indent-tabs-mode: nil
107 * c-file-style: "stroustrup"
109 * vim: shiftwidth=4 tabstop=8 expandtab