| 1 | { |
| 2 | "parameters": { |
| 3 | "TestCaseId": { |
| 4 | "type": "string", |
| 5 | "required": true, |
| 6 | "documentation": "Test case id used to select the test case to use" |
| 7 | }, |
| 8 | "Input": { |
| 9 | "type": "string", |
| 10 | "required": true, |
| 11 | "documentation": "the input used to test substring" |
| 12 | } |
| 13 | }, |
| 14 | "rules": [ |
| 15 | { |
| 16 | "documentation": "Substring from beginning of input", |
| 17 | "conditions": [ |
| 18 | { |
| 19 | "fn": "stringEquals", |
| 20 | "argv": [ |
| 21 | "{TestCaseId}", |
| 22 | "1" |
| 23 | ] |
| 24 | }, |
| 25 | { |
| 26 | "fn": "substring", |
| 27 | "argv": [ |
| 28 | "{Input}", |
| 29 | 0, |
| 30 | 4, |
| 31 | false |
| 32 | ], |
| 33 | "assign": "output" |
| 34 | } |
| 35 | ], |
| 36 | "error": "The value is: `{output}`", |
| 37 | "type": "error" |
| 38 | }, |
| 39 | { |
| 40 | "documentation": "Substring from end of input", |
| 41 | "conditions": [ |
| 42 | { |
| 43 | "fn": "stringEquals", |
| 44 | "argv": [ |
| 45 | "{TestCaseId}", |
| 46 | "2" |
| 47 | ] |
| 48 | }, |
| 49 | { |
| 50 | "fn": "substring", |
| 51 | "argv": [ |
| 52 | "{Input}", |
| 53 | 0, |
| 54 | 4, |
| 55 | true |
| 56 | ], |
| 57 | "assign": "output" |
| 58 | } |
| 59 | ], |
| 60 | "error": "The value is: `{output}`", |
| 61 | "type": "error" |
| 62 | }, |
| 63 | { |
| 64 | "documentation": "Substring the middle of the string", |
| 65 | "conditions": [ |
| 66 | { |
| 67 | "fn": "stringEquals", |
| 68 | "argv": [ |
| 69 | "{TestCaseId}", |
| 70 | "3" |
| 71 | ] |
| 72 | }, |
| 73 | { |
| 74 | "fn": "substring", |
| 75 | "argv": [ |
| 76 | "{Input}", |
| 77 | 1, |
| 78 | 3, |
| 79 | false |
| 80 | ], |
| 81 | "assign": "output" |
| 82 | } |
| 83 | ], |
| 84 | "error": "The value is: `{output}`", |
| 85 | "type": "error" |
| 86 | }, |
| 87 | { |
| 88 | "documentation": "fallback when no tests match", |
| 89 | "conditions": [], |
| 90 | "error": "No tests matched", |
| 91 | "type": "error" |
| 92 | } |
| 93 | ], |
| 94 | "version": "1.3" |
| 95 | } |