Changeset 8dd38e for src/Patterns/unittests/PrototypeFactoryUnitTest.cpp
- Timestamp:
- Jan 10, 2011, 8:06:49 PM (15 years ago)
- Children:
- 192c04
- Parents:
- 9f39db
- git-author:
- Frederik Heber <heber@…> (01/06/11 23:48:30)
- git-committer:
- Frederik Heber <heber@…> (01/10/11 20:06:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/unittests/PrototypeFactoryUnitTest.cpp
r9f39db r8dd38e 161 161 } 162 162 163 void PrototypeFactoryTest:: PrototypeManipulatortest()163 void PrototypeFactoryTest::getPrototypetest() 164 164 { 165 165 // this method is protected and only friends may access it. 166 IPrototype *rndA_1 = PrototypeFactoryStub::getInstance().getPrototypeManipulator(std::string("Aclass")); 167 168 // do something with the prototype. 169 rndA_1->setcount(256); 166 const IPrototype& rndA_1c = PrototypeFactoryStub::getInstance().getPrototype(std::string("Aclass")); 170 167 171 168 // clone the type and check whether new default values holds 172 169 rndA_2 = PrototypeFactoryStub::getInstance().getProduct(PrototypeFactoryStub::Aclass); 173 CPPUNIT_ASSERT_EQUAL( 256, rndA_2->getcount() ); 170 CPPUNIT_ASSERT_EQUAL( rndA_1c.getcount(), rndA_2->getcount() ); 171 rndA_2->count(); 172 CPPUNIT_ASSERT( rndA_1c.getcount() != rndA_2->getcount() ); 174 173 175 // rndA has been cloned before we have manipulated the prototype 176 CPPUNIT_ASSERT( rndA->getcount() != rndA_2->getcount() ); 177 178 // do something with the prototype. 179 rndA_1->setcount(0); 174 // the following is not possible 175 //rndA_1c.count(); 180 176 181 177 rndA_3 = PrototypeFactoryStub::getInstance().getProduct(PrototypeFactoryStub::Aclass); … … 183 179 CPPUNIT_ASSERT( rndA->getcount() == rndA_3->getcount() ); 184 180 } 185 186 void PrototypeFactoryTest::installPrototypetest()187 {188 Prototype< teststubs::Aclass> *newprototype = new Prototype< teststubs::Aclass> ();189 newprototype->setcount(1);190 PrototypeFactoryStub::getInstance().installPrototype(newprototype, std::string("Aclass"));191 newprototype = NULL;192 193 IPrototype *rndA_1 = PrototypeFactoryStub::getInstance().getProduct(std::string("Aclass"));194 CPPUNIT_ASSERT( 1 == rndA_1->getcount() );195 196 rndA_1->count();197 CPPUNIT_ASSERT( 2 == rndA_1->getcount() );198 199 IPrototype *rndA_2 = PrototypeFactoryStub::getInstance().getProduct(std::string("Aclass"));200 CPPUNIT_ASSERT( 1 == rndA_2->getcount() );201 CPPUNIT_ASSERT( rndA_1->getcount() != rndA_2->getcount() );202 }
Note:
See TracChangeset
for help on using the changeset viewer.
