#######################################################
#
# Test getvalues()
#
#######################################################
# If we run getvalues on a classic array index that contains a string
# we should end up with a list made up of that single value
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

#######################################################
bundle agent test
{
  vars:
    "array[string]" string => "scrumdiddlyumptious";
    "array[slist]" slist => { "1", "2" };
    "array[idx][2]" slist => { "3", "4" }; # DO not expect to get these values
    "values" slist => getvalues("array");
}

#######################################################
bundle agent check
{
  vars:
    "expected" slist => { "scrumdiddlyumptious", 1, 2 };
    "diff" slist => difference(expected, "test.values");

  classes:
    "_pass" expression => strcmp(length(diff), 0);

  methods:
    _pass::
      "pass" usebundle => dcs_pass("$(this.promise_filename)");

    !_pass::
      "pass" usebundle => dcs_fail("$(this.promise_filename)");
}
