-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Description
Issue overview
WorkspaceObject::setString allows setting invalid names for ModelObjects
Current Behavior
WorkspaceObject::setString assumes name index is always 0, for ModelObjects name index is 1. This allows user to set invalid names using WorkspaceObject::setString.
Expected Behavior
The following test should pass:
Model model;
Space space1(model);
Space space2(model);
unsigned nameIndex = 1;
EXPECT_TRUE(space1.setString(nameIndex, "Space 1"));
ASSERT_TRUE(space1.getString(nameIndex));
EXPECT_EQ("Space 1", space1.getString(nameIndex).get());
EXPECT_FALSE(space2.setString(nameIndex, "Space 1"));
ASSERT_TRUE(space2.getString(nameIndex));
EXPECT_NE("Space 1", space2.getString(nameIndex).get());
EXPECT_FALSE(space2.setString(nameIndex, ""));
ASSERT_TRUE(space2.getString(nameIndex));
EXPECT_NE("", space2.getString(nameIndex).get());
Reactions are currently unavailable