1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include "catch2_common.h"
static constexpr double k_initial_value{1.1234};
template <class Base>
class AttrConfEventData : public Base
{
public:
using Base::Base;
void init_device() override { }
void read_attr(Tango::Attribute &att) override
{
att.set_value(&attr_dq_double);
}
static void attribute_factory(std::vector<Tango::Attr *> &attrs)
{
attrs.push_back(new TangoTest::AutoAttr<&AttrConfEventData::read_attr>("double_attr", Tango::DEV_DOUBLE));
}
private:
Tango::DevDouble attr_dq_double{k_initial_value};
};
TANGO_TEST_AUTO_DEV_TMPL_INSTANTIATE(AttrConfEventData, 1)
SCENARIO("Setting AttributeConfig works without database")
{
int idlver = GENERATE(TangoTest::idlversion(1));
GIVEN("a device proxy to a simple IDLv" << idlver << " device")
{
TangoTest::Context ctx{"double_attr", "AttrConfEventData", idlver};
auto device = ctx.get_proxy();
REQUIRE(idlver == device->get_idl_version());
THEN("we can change the attribute configuration")
{
std::string attr{"double_attr"};
auto ai = device->attribute_query(attr);
ai.events.ch_event.abs_change = "33333";
ai.events.ch_event.rel_change = "99.99";
Tango::AttributeInfoListEx ail;
ail.push_back(ai);
REQUIRE_NOTHROW(device->set_attribute_config(ail));
}
}
}
|