Changeset 724564 for src/Patterns/unittests/FactoryUnitTest.cpp
- Timestamp:
- Jan 4, 2011, 5:15:14 PM (15 years ago)
- Children:
- 1afcbe
- Parents:
- 746ff1
- git-author:
- Frederik Heber <heber@…> (01/04/11 15:57:33)
- git-committer:
- Frederik Heber <heber@…> (01/04/11 17:15:14)
- File:
-
- 1 edited
-
src/Patterns/unittests/FactoryUnitTest.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/unittests/FactoryUnitTest.cpp
r746ff1 r724564 22 22 #include "FactoryUnitTest.hpp" 23 23 24 #include "stubs/CommonStub.hpp" 24 25 #include "stubs/FactoryStub.hpp" 25 26 … … 68 69 void FactoryTest::setUp() 69 70 { 70 FactoryStub::getInstance(); 71 rndA = 72 FactoryStub::getInstance(). 73 PrototypeTable[FactoryStub::Aclass]->create(); 74 rndB = 75 FactoryStub::getInstance(). 76 PrototypeTable[FactoryStub::Bclass]->create(); 71 77 } 72 78 73 79 void FactoryTest::tearDown() 74 80 { 81 delete rndA; 82 delete rndB; 75 83 FactoryStub::purgeInstance(); 76 84 } … … 93 101 } 94 102 95 // check one of the distributions in the table 96 ICreatorStub * rnd = 97 FactoryStub::getInstance(). 98 PrototypeTable[FactoryStub::Aclass]->create(); 103 // check distributions in the table 99 104 CPPUNIT_ASSERT_EQUAL( 100 105 std::string(typeid(teststubs::Aclass).name()), 101 rnd ->name()106 rndA->name() 102 107 ); 103 delete rnd; 108 CPPUNIT_ASSERT_EQUAL( 109 std::string(typeid(teststubs::Bclass).name()), 110 rndB->name() 111 ); 104 112 } 113 114 115 void FactoryTest::getProductEnumTest() 116 { 117 ICreatorStub * rndA_1 = 118 FactoryStub::getInstance().getProduct(FactoryStub::Aclass); 119 CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) ); 120 delete rndA_1; 121 } 122 123 void FactoryTest::getProductNameTest() 124 { 125 ICreatorStub * rndA_1 = 126 FactoryStub::getInstance().getProduct(std::string("Aclass")); 127 CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) ); 128 delete rndA_1; 129 } 130 131 void FactoryTest::getProductTypeTest() 132 { 133 ICreatorStub * rndA_1 = 134 FactoryStub::getInstance().getProduct( typeid(teststubs::Aclass) ); 135 CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) ); 136 delete rndA_1; 137 }
Note:
See TracChangeset
for help on using the changeset viewer.
