TEST_F(IddFixture,IddFactory_IddObjects)
{
    IddObject object;

    OptionalIddObject candidate = IddFactory::instance().getObject(IddObjectType::UserCustom);
    EXPECT_FALSE(candidate);

    candidate = IddFactory::instance().getObject(IddObjectType::Catchall);
    ASSERT_TRUE(candidate);
    object = *candidate;
    candidate = IddFactory::instance().getObject("catchall");
    ASSERT_TRUE(candidate);
    EXPECT_TRUE(object == *candidate);

    candidate = IddFactory::instance().getObject(IddObjectType::CommentOnly);
    ASSERT_TRUE(candidate);
    object = *candidate;
    candidate = IddFactory::instance().getObject("coMmentonLy");
    ASSERT_TRUE(candidate);
    EXPECT_TRUE(object == *candidate);

    candidate = IddFactory::instance().getObject(IddObjectType::Lights);
    ASSERT_TRUE(candidate);
    object = *candidate;
    candidate = IddFactory::instance().getObject("lights");
    ASSERT_TRUE(candidate);
    EXPECT_TRUE(object == *candidate);
    EXPECT_EQ("Lights", object.name());
    ASSERT_TRUE(object.nonextensibleFields().size() > static_cast<unsigned>(0));
    EXPECT_EQ("Return Air Fraction Function of Plenum Temperature Coefficient 2",
              object.nonextensibleFields().back().name());

    OptionalIddField field = object.getField(0);
    ASSERT_TRUE(field);
    EXPECT_EQ("Name",field->name());
    EXPECT_TRUE(field->properties().required);
    EXPECT_EQ(IddFieldType(IddFieldType::AlphaType),field->properties().type);
    ASSERT_TRUE(!field->properties().references.empty());
    EXPECT_EQ(static_cast<unsigned>(1), field->properties().references.size());
    EXPECT_EQ("LightsNames", *(field->properties().references.begin()));
    EXPECT_FALSE(field->properties().stringDefault); // OptionalString should be false--no default name
    EXPECT_EQ(IddFieldProperties::Unbounded,field->properties().minBoundType);

    ASSERT_TRUE(object.nonextensibleFields().size() > static_cast<unsigned>(3));
    field = object.getField(3);
    EXPECT_EQ("Design Level Calculation Method",field->name());
    EXPECT_FALSE(field->properties().required);
    EXPECT_TRUE(field->properties().stringDefault);
    EXPECT_EQ("LightingLevel",*(field->properties().stringDefault));
    EXPECT_EQ(IddFieldType(IddFieldType::ChoiceType),field->properties().type);
    EXPECT_EQ(static_cast<unsigned>(3),field->keys().size());
}
 bool operator()(const IddObject& object) {
     // fields that are \autocalculatable with no default, or a default other than 'autocalculate',
     // or fields that are \autosizable with no default or a default other than 'autosize'.
     for (const IddField& iddField : object.nonextensibleFields()) {
         if (iddField.properties().autocalculatable && (!iddField.properties().stringDefault ||
                 !istringEqual("autocalculate",iddField.properties().stringDefault.get())))
         {
             return true;
         }
         if (iddField.properties().autosizable && (!iddField.properties().stringDefault ||
                 !istringEqual("autosize",iddField.properties().stringDefault.get())))
         {
             return true;
         }
     }
     return false;
 }