Commit 073d04f4 authored by Thomas Braun's avatar Thomas Braun
Browse files

Test/TwoParameterAttributeHistoryWorks: Add variant for list commands

parent 658393b8
Loading
Loading
Loading
Loading
+38 −2
Original line number Diff line number Diff line
@@ -357,10 +357,12 @@ BOOST_DATA_TEST_CASE_F(AddAndExportDeviceFixture,
                       TwoParameterAttributeHistoryWorks,
                       data::make({"DbPutProperty", "DbPutClassProperty", "DbPutDeviceProperty"}) ^
                           data::make({"DbGetPropertyHist", "DbGetClassPropertyHist", "DbGetDevicePropertyHist"}) ^
                           data::make({"DbDeleteProperty", "DbDeleteClassProperty", "DbDeleteDeviceProperty"}),
                           data::make({"DbDeleteProperty", "DbDeleteClassProperty", "DbDeleteDeviceProperty"}) ^
                           data::make({"DbGetPropertyList", "DbGetClassPropertyList", "DbGetDevicePropertyList"}),
                       putCommand,
                       getHistoryCommand,
                       deleteCommand)
                       deleteCommand,
                       listCommand)
{
    const std::string objName{"globalObjOrClassOrDevice"};
    const std::string propName{"propName0"};
@@ -392,6 +394,40 @@ BOOST_DATA_TEST_CASE_F(AddAndExportDeviceFixture,
        BOOST_CHECK_NO_THROW(reply = dp->command_inout(putCommand, in));
    }

    // list properties with wildcard
    {
        std::string plainStringCommand = "DbGetClassPropertyList";

        Tango::DeviceData reply;
        if(plainStringCommand == listCommand)
        {
            auto in = MakeDeviceDataString(objName);
            BOOST_CHECK_NO_THROW(reply = dp->command_inout(listCommand, in));

            // also test the wildcard variant
            {
                Tango::DeviceData reply_wc;
                auto in_wc = MakeDeviceDataStringArray({objName, "propName*"});
                BOOST_CHECK_NO_THROW(reply_wc = dp->command_inout("DbGetClassPropertyListWildcard", in_wc));

                auto vec = ExtractStringVector(reply_wc);

                std::vector<std::string> ref = {"propName0", "propName1"};
                BOOST_CHECK_EQUAL_COLLECTIONS(std::begin(vec), std::end(vec), std::begin(ref), std::end(ref));
            }
        }
        else
        {
            auto in = MakeDeviceDataStringArray({objName, "propName*"});
            BOOST_CHECK_NO_THROW(reply = dp->command_inout(listCommand, in));
        }

        auto vec = ExtractStringVector(reply);

        std::vector<std::string> ref = {"propName0", "propName1"};
        BOOST_CHECK_EQUAL_COLLECTIONS(std::begin(vec), std::end(vec), std::begin(ref), std::end(ref));
    }

    // also if we now add a new vector value entry for propName0 we still get DEFAULT_HISTORY_DEPTH back below
    {
        std::string propValue = "prop0ValueVec0";