[Clam-devel] Factory::Registry question on IRC

Pau Arumi parumi at iua.upf.edu
Mon Jun 11 01:49:30 PDT 2007


Andreas, about the question you raised at IRC (don't know exactly
when). This is the failing test:

void testGetCreator_CorrectKeyWithTwoCreators()
{
    MyFactoryType::Registry reg;
    // set up
    reg.AddCreator( "DummyProductFoo", new FooCreator() );
    reg.AddCreator( "DummyProductBar", new BarCreator() );
    MyFactoryType::Creator* fooCreator = new FooCreator();
    CPPUNIT_ASSERT( fooCreator == &reg.GetCreator("DummyProductFoo") );
}

After the Factory::Registry static-function -> objects refactoring
we need to test that the returned pointer is the same one as we
registered. Something like

    MyFactoryType::Creator* fooCreator = new FooCreator();
    reg.AddCreator( "DummyProductFoo", fooCreator );
    reg.AddCreator( "DummyProductBar", new BarCreator() );

    CPPUNIT_ASSERT( fooCreator == reg.GetCreator("DummyProductFoo")

Note also that the "&" was wrong in the current situation.

Cheers
Pau




More information about the clam-devel mailing list