body common control
{
  bundlesequence => { "test", "check" };
}

bundle agent test
{
  meta:
    "description" -> { "CFE-4562" }
      string => "Test for expected results from classfilterdata() with object of arrays using index in object";

  vars:
    "test"
      data => '{
        "/etc/chrony.conf":      [ "0644", "root", "root",     "foo" ],
        "/etc/apt/sources.list": [  "644", "root", "root", "foo|bar" ],
        "/etc/apt/apt.conf":     [  "644", "root", "root",     "bar" ]
      }';

    "actual"
      data => classfilterdata("@(test)", "object_of_arrays", "3");

  classes:
    "foo";
}

bundle agent check
{
  vars:
    "expected"
      string => storejson('{
        "/etc/chrony.conf":      [ "0644", "root", "root",     "foo" ],
        "/etc/apt/sources.list": [  "644", "root", "root", "foo|bar" ]
      }');
    "actual"
      string => storejson("@(test.actual)");

  classes:
    "ok"
      expression => strcmp("$(expected)", "$(actual)");

  reports:
      "Expected: '$(expected)', actual: '$(actual)'";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}
