I hereby claim:
- I am d4nte on github.
- I am froyer (https://keybase.io/froyer) on keybase.
- I have a public key ASDShRwM1S6QFnIhN7I4aDtRMIa4drhsHW7TDyuNM3Fgiwo
To claim this, I am signing this object:
std::string MyNewFeature::greet(const StinkyOldLegacyDataClass& iData) | |
{ | |
std::string str = "Merry Christmas! "; | |
str.append(iData.getString()); | |
return str; | |
} |
class MyNewFeature | |
{ | |
public: | |
MyNewFeature() | |
{} | |
std::string greet(const StinkyOldLegacyDataClass& iData); | |
}; |
class StinkyOldLegacyDataClass | |
{ | |
public: | |
virtual const std::string getString() const = 0; | |
virtual const int getInt() const = 0; | |
// And many other getters | |
}; |
class MockStinkyOldLegacyDataClass: public StinkyOldLegacyDataClass | |
{ | |
public: | |
MOCK_CONST_METHOD0(getString, const std::string()); | |
MOCK_CONST_METHOD0(getInt, const int()); | |
// And so on, 50 more of those please | |
// ... | |
}; |
using ::testing::Return; | |
using ::testing::NiceMock; | |
namespace | |
{ | |
TEST(MyNewFeatureTest, PrependFestiveWord) | |
{ | |
NiceMock<MockStinkyOldLegacyDataClass> myMock; | |
std::string strDef = "ho ho ho"; |
std::string MyNewFeature::greet(const StinkyOldLegacyDataClass& iData) | |
{ | |
std::string str = "Merry Christmas! "; | |
const int aInt = iData.getInt(); | |
if (aInt) | |
{ | |
str = "Creepy Halloween! "; | |
} | |
str.append(iData.getString()); | |
return str; |
class MyNewFeatureAbstract | |
{ | |
public: | |
std::string greet(); | |
protected: | |
virtual const std::string getDataString() const = 0; | |
}; | |
class MyNewFeature: public MyNewFeatureAbstract |
std::string MyNewFeatureAbstract::greet() | |
{ | |
std::string str = "Merry Christmas! "; | |
str.append(getDataString()); | |
return str; | |
} | |
const std::string MyNewFeature::getDataString() const | |
{ | |
return _data.getString(); |
using ::testing::Return; | |
using ::testing::NiceMock; | |
struct MockMyNewFeature: public MyNewFeatureAbstract | |
{ | |
MOCK_CONST_METHOD0(getDataString, const std::string()); | |
}; | |
namespace | |
{ |
I hereby claim:
To claim this, I am signing this object: