1 /* $Id: test_filter_factory.cpp,v 1.4 2005-10-31 09:40:18 marc 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(){
43 //int main(int argc, char **argv)
44 BOOST_AUTO_TEST_CASE( test_filter_factory_1 )
48 yp2::filter::FilterFactory ffactory;
53 const std::string xfid = "XFilter";
54 const std::string yfid = "YFilter";
56 //std::cout << "Xfilter name: " << xfid << std::endl;
57 //std::cout << "Yfilter name: " << yfid << std::endl;
59 BOOST_CHECK_EQUAL(ffactory.add_creator(xfid, xfilter_creator),
61 BOOST_CHECK_EQUAL(ffactory.drop_creator(xfid),
63 BOOST_CHECK_EQUAL(ffactory.add_creator(xfid, xfilter_creator),
65 BOOST_CHECK_EQUAL(ffactory.add_creator(yfid, yfilter_creator),
68 yp2::filter::Base* xfilter = 0;
69 xfilter = ffactory.create(xfid);
70 yp2::filter::Base* yfilter = 0;
71 yfilter = ffactory.create(yfid);
73 //BOOST_CHECK_EQUAL(sizeof(xf), sizeof(*xfilter));
74 //BOOST_CHECK_EQUAL(sizeof(yf), sizeof(*yfilter));
76 BOOST_CHECK(0 != xfilter);
77 BOOST_CHECK(0 != yfilter);
92 // get function - right val in assignment
93 //std::string name() const {
98 // set function - left val in assignment
99 //std::string & name() {
103 // set function - can be chained
104 //Base & name(const std::string & name){
113 * indent-tabs-mode: nil
114 * c-file-style: "stroustrup"
116 * vim: shiftwidth=4 tabstop=8 expandtab