|
| 1 | +body common control |
| 2 | +{ |
| 3 | + bundlesequence => { "check" }; |
| 4 | +} |
| 5 | + |
| 6 | +bundle agent test(context, index) |
| 7 | +{ |
| 8 | + meta: |
| 9 | + "description" -> { "ENT-6193", "CFE-3421" } |
| 10 | + string => "Test for expected results from policy function classfilterdata()"; |
| 11 | + |
| 12 | + vars: |
| 13 | + "test" |
| 14 | + data => '[ |
| 15 | + [ "foo", "!foo", "foo&bar", "foo|bar" ], |
| 16 | + [ "bar", "!bar", "bar&baz", "bar|baz" ], |
| 17 | + [ "baz", "!baz", "foo&baz", "foo|baz" ], |
| 18 | + ]'; |
| 19 | + |
| 20 | + "actual" |
| 21 | + data => classfilterdata("@(test)", "array_of_arrays", "$(index)"); |
| 22 | + |
| 23 | + classes: |
| 24 | + "$(context)"; |
| 25 | + |
| 26 | + reports: |
| 27 | + "$(with)" |
| 28 | + with => storejson("@(actual)"), |
| 29 | + bundle_return_value_index => "$(index)"; |
| 30 | +} |
| 31 | + |
| 32 | +bundle agent check |
| 33 | +{ |
| 34 | + vars: |
| 35 | + "context" slist => { "foo" }; |
| 36 | + |
| 37 | + "expected[0]" |
| 38 | + string => storejson('[ |
| 39 | + [ "foo", "!foo", "foo&bar", "foo|bar" ] |
| 40 | + ]'); |
| 41 | + "expected[1]" |
| 42 | + string => storejson('[ |
| 43 | + [ "bar", "!bar", "bar&baz", "bar|baz" ], |
| 44 | + [ "baz", "!baz", "foo&baz", "foo|baz" ] |
| 45 | + ]'); |
| 46 | + "expected[2]" |
| 47 | + string => storejson('[ |
| 48 | + ]'); |
| 49 | + |
| 50 | + classes: |
| 51 | + "ok_0" |
| 52 | + expression => strcmp("$(expected[0])", |
| 53 | + "$(actual[0])"); |
| 54 | + "ok_1" |
| 55 | + expression => strcmp("$(expected[1])", |
| 56 | + "$(actual[1])"); |
| 57 | + "ok_2" |
| 58 | + expression => strcmp("$(expected[1])", |
| 59 | + "$(actual[1])"); |
| 60 | + "ok" |
| 61 | + expression => and("ok_0", "ok_1", "ok_2"); |
| 62 | + |
| 63 | + methods: |
| 64 | + "classes: foo, index: 0" |
| 65 | + usebundle => test("@(context)", 0), |
| 66 | + useresult => "actual"; |
| 67 | + "classes: foo, index: 1" |
| 68 | + usebundle => test("@(context)", 1), |
| 69 | + useresult => "actual"; |
| 70 | + "classes: foo, index: 2" |
| 71 | + usebundle => test("@(context)", 1), |
| 72 | + useresult => "actual"; |
| 73 | + |
| 74 | + reports: |
| 75 | + !ok_0:: |
| 76 | + "Expected: $(expected[0])"; |
| 77 | + "Actual: $(actual[0])"; |
| 78 | + !ok_1:: |
| 79 | + "Expected: $(expected[1])"; |
| 80 | + "Actual: $(actual[1])"; |
| 81 | + !ok_2:: |
| 82 | + "Expected: $(expected[2])"; |
| 83 | + "Actual: $(actual[2])"; |
| 84 | + ok:: |
| 85 | + "$(this.promise_filename) Pass"; |
| 86 | + !ok:: |
| 87 | + "$(this.promise_filename) FAIL"; |
| 88 | +} |
0 commit comments