Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 1667935

Browse files
committed
Add test for max alarm change below current value
Test for changing alarm treshold to value lower than currently read from hardware. Attribute should have alarm quality after property change.
1 parent b61b7c4 commit 1667935

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

cpp_test_suite/new_tests/cxx_attr_misc.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,30 @@ cout << "status = " << status << endl;
10781078
#undef QUOTE
10791079
#undef __QUOTE
10801080

1081+
/*
1082+
* Test for changing alarm treshold to value lower than currently read from
1083+
* hardware. Attribute should have alarm quality after property change.
1084+
*/
1085+
1086+
void test_change_max_alarm_threshold_below_current_value()
1087+
{
1088+
const char* attr_name = "Short_attr_rw";
1089+
const DevShort attr_value = 20;
1090+
1091+
DeviceAttribute value(attr_name, attr_value);
1092+
TS_ASSERT_THROWS_NOTHING(device1->write_attribute(value));
1093+
1094+
TS_ASSERT_EQUALS(Tango::ON, device1->state());
1095+
TS_ASSERT_EQUALS(Tango::ATTR_VALID, device1->read_attribute(attr_name).get_quality());
1096+
1097+
auto config = device1->get_attribute_config(attr_name);
1098+
config.alarms.max_alarm = std::to_string(attr_value - 1);
1099+
AttributeInfoListEx config_in = { config };
1100+
TS_ASSERT_THROWS_NOTHING(device1->set_attribute_config(config_in));
1101+
1102+
TS_ASSERT_EQUALS(Tango::ALARM, device1->state());
1103+
TS_ASSERT_EQUALS(Tango::ATTR_ALARM, device1->read_attribute(attr_name).get_quality());
1104+
}
10811105
};
10821106
#undef cout
10831107
#endif // AttrMiscTestSuite_h

0 commit comments

Comments
 (0)