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 key to object";

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

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

  classes:
    "bar";
}

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

    "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";
}
