-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnyParameterProperties tests #4421
Changes from 1 commit
400fdca
af9ba26
fcfe78d
690c833
27fe165
1e58b69
eee7074
2cc3835
a5dc6b5
45caae8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -708,48 +708,48 @@ TEST(AnyParameterProperties, new_api_default) | |
{ | ||
AnyParameterProperties params = AnyParameterProperties(); | ||
|
||
EXPECT_TRUE(params.equals(ParameterProperties())); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::MODEL)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::GRADIENT)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::HYPER)); | ||
EXPECT_TRUE(params.compare_mask(ParameterProperties())); | ||
} | ||
|
||
TEST(AnyParameterProperties, old_custom_ctor) | ||
{ | ||
AnyParameterProperties params = AnyParameterProperties( | ||
"test", EModelSelectionAvailability::MS_NOT_AVAILABLE, | ||
EGradientAvailability::GRADIENT_AVAILABLE, true); | ||
EGradientAvailability::GRADIENT_NOT_AVAILABLE, false); | ||
|
||
EXPECT_EQ(params.get_description(), "test"); | ||
EXPECT_EQ( | ||
params.get_model_selection(), | ||
EModelSelectionAvailability::MS_NOT_AVAILABLE); | ||
EXPECT_EQ(params.get_gradient(), EGradientAvailability::GRADIENT_AVAILABLE); | ||
EXPECT_TRUE(params.get_model()); | ||
|
||
EXPECT_TRUE(params.has_property(ParameterProperties::MODEL)); | ||
EXPECT_TRUE(params.has_property(ParameterProperties::GRADIENT)); | ||
EXPECT_TRUE(params.equals( | ||
ParameterProperties::MODEL | ParameterProperties::GRADIENT)); | ||
EXPECT_FALSE(params.equals(ParameterProperties::MODEL)); | ||
EXPECT_EQ( | ||
params.get_gradient(), EGradientAvailability::GRADIENT_NOT_AVAILABLE); | ||
EXPECT_FALSE(params.get_model()); | ||
|
||
EXPECT_FALSE(params.compare_mask( | ||
ParameterProperties::MODEL | ParameterProperties::HYPER | | ||
ParameterProperties::HYPER)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::HYPER)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::GRADIENT)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::MODEL)); | ||
} | ||
|
||
TEST(AnyParameterProperties, new_custom_ctor) | ||
{ | ||
AnyParameterProperties params = AnyParameterProperties( | ||
"test", ParameterProperties::MODEL | ParameterProperties::GRADIENT); | ||
AnyParameterProperties params = | ||
AnyParameterProperties("test", ParameterProperties()); | ||
|
||
EXPECT_EQ(params.get_description(), "test"); | ||
EXPECT_EQ( | ||
params.get_model_selection(), | ||
EModelSelectionAvailability::MS_NOT_AVAILABLE); | ||
EXPECT_EQ(params.get_gradient(), EGradientAvailability::GRADIENT_AVAILABLE); | ||
EXPECT_TRUE(params.get_model()); | ||
EXPECT_EQ( | ||
params.get_gradient(), EGradientAvailability::GRADIENT_NOT_AVAILABLE); | ||
EXPECT_FALSE(params.get_model()); | ||
|
||
EXPECT_TRUE(params.has_property(ParameterProperties::MODEL)); | ||
EXPECT_TRUE(params.has_property(ParameterProperties::GRADIENT)); | ||
EXPECT_TRUE(params.equals( | ||
ParameterProperties::MODEL | ParameterProperties::GRADIENT)); | ||
EXPECT_FALSE(params.compare_mask( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope, this just checks that one is not set. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but this empty mask should be created via not explicitly listing the available types. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK! And the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure what you mean, but what about something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can, and of course it is the same. But then it wouldnt test that the default properties are indeed empty, so the test would not be of an use: It would just test that if you create two properties with the default ctor, they have the same parameters. If you would check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok! But then in that case it might make more sense to instantiate the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes that is even more explicit |
||
ParameterProperties::MODEL | ParameterProperties::HYPER | | ||
ParameterProperties::HYPER)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::HYPER)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these last 3 as well |
||
EXPECT_FALSE(params.has_property(ParameterProperties::GRADIENT)); | ||
EXPECT_FALSE(params.has_property(ParameterProperties::MODEL)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the last three are nop now