Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Don't test variants of all params.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogenvik committed Feb 25, 2012
1 parent 9223ff8 commit 7639956
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/ElementExerciser.h
Expand Up @@ -22,9 +22,11 @@ class ElementParam
{ {
public: public:
Atlas::Message::Element defaultElement; Atlas::Message::Element defaultElement;
bool testVariants;


ElementParam(Atlas::Message::Element defaultElement) : ElementParam(Atlas::Message::Element defaultElement, bool testVariants =
defaultElement(defaultElement) true) :
defaultElement(defaultElement), testVariants(testVariants)
{ {
} }


Expand Down Expand Up @@ -136,14 +138,15 @@ class ElementExerciser
//throwing an exception or crashing. //throwing an exception or crashing.
for (std::map<std::string, ElementParam>::const_iterator I = for (std::map<std::string, ElementParam>::const_iterator I =
mElementParams.begin(); I != mElementParams.end(); ++I) { mElementParams.begin(); I != mElementParams.end(); ++I) {
for (size_t i = 0; i < (sizeof(types) / sizeof(*types)); ++i) { if (I->second.testVariants) {
Atlas::Message::Element::Type type = types[i]; for (size_t i = 0; i < (sizeof(types) / sizeof(*types)); ++i) {
EntityType entity; Atlas::Message::Element::Type type = types[i];
fillAllCorrectParams(entity); EntityType entity;
fillParam(entity, I->first, type); fillAllCorrectParams(entity);
mExerciseSlot(entity); fillParam(entity, I->first, type);
mExerciseSlot(entity);
}
} }

} }


} }
Expand Down
1 change: 1 addition & 0 deletions test/ServerInfo_unittest.cpp
Expand Up @@ -59,6 +59,7 @@ int main()
sigc::mem_fun(info, &Eris::TestServerInfo::injectAtlas)); sigc::mem_fun(info, &Eris::TestServerInfo::injectAtlas));
ElementExerciser<Atlas::Objects::Entity::RootEntity> exerciser(slot); ElementExerciser<Atlas::Objects::Entity::RootEntity> exerciser(slot);
exerciser.addParam("ruleset", ElementParam("mason")); exerciser.addParam("ruleset", ElementParam("mason"));
exerciser.addParam("name", ElementParam("a server", false));
exerciser.addParam("clients", ElementParam(2)); exerciser.addParam("clients", ElementParam(2));
exerciser.addParam("server", ElementParam("localhost")); exerciser.addParam("server", ElementParam("localhost"));
exerciser.addParam("uptime", ElementParam(1000.0f)); exerciser.addParam("uptime", ElementParam(1000.0f));
Expand Down

0 comments on commit 7639956

Please sign in to comment.