@fincity/kirun-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/.prettierrc +9 -0
  2. package/__tests__/engine/function/system/array/AddFirstTest.ts +235 -0
  3. package/__tests__/engine/function/system/array/AddTest.ts +126 -0
  4. package/__tests__/engine/function/system/array/BinarySearchTest.ts +135 -0
  5. package/__tests__/engine/function/system/array/CompareTest.ts +48 -0
  6. package/__tests__/engine/function/system/array/CopyTest.ts +86 -0
  7. package/__tests__/engine/function/system/array/DeleteFirstTest.ts +103 -0
  8. package/__tests__/engine/function/system/array/DeleteFromTest.ts +232 -0
  9. package/__tests__/engine/function/system/array/DeleteLastTest.ts +103 -0
  10. package/__tests__/engine/function/system/array/DeleteTest.ts +110 -0
  11. package/__tests__/engine/function/system/array/DisjointTest.ts +184 -0
  12. package/__tests__/engine/function/system/array/Equals.ts +67 -0
  13. package/__tests__/engine/function/system/array/FillTest.ts +36 -0
  14. package/__tests__/engine/function/system/array/FrequencyTest.ts +97 -0
  15. package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +347 -0
  16. package/__tests__/engine/function/system/array/IndexOfTest.ts +267 -0
  17. package/__tests__/engine/function/system/array/InsertTest.ts +229 -0
  18. package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +213 -0
  19. package/__tests__/engine/function/system/array/LastIndexOfTest.ts +253 -0
  20. package/__tests__/engine/function/system/array/MaxTest.ts +98 -0
  21. package/__tests__/engine/function/system/array/MinTest.ts +99 -0
  22. package/__tests__/engine/function/system/array/MisMatchTest.ts +215 -0
  23. package/__tests__/engine/function/system/array/ReverseTest.ts +235 -0
  24. package/__tests__/engine/function/system/array/RotateTest.ts +137 -0
  25. package/__tests__/engine/function/system/array/ShuffleTest.ts +154 -0
  26. package/__tests__/engine/function/system/array/SortTest.ts +130 -0
  27. package/__tests__/engine/function/system/array/SubArrayTest.ts +236 -0
  28. package/__tests__/engine/function/system/math/AddTest.ts +12 -0
  29. package/__tests__/engine/function/system/string/ConcatenateTest.ts +46 -0
  30. package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +38 -0
  31. package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +53 -0
  32. package/__tests__/engine/function/system/string/PostPadTest.ts +54 -0
  33. package/__tests__/engine/function/system/string/PrePadTest.ts +54 -0
  34. package/__tests__/engine/function/system/string/RegionMatchesTest.ts +78 -0
  35. package/__tests__/engine/function/system/string/ReverseTest.ts +36 -0
  36. package/__tests__/engine/function/system/string/SplitTest.ts +61 -0
  37. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +126 -0
  38. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +54 -0
  39. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +146 -0
  40. package/__tests__/engine/function/system/string/ToStringTest.ts +43 -0
  41. package/__tests__/engine/function/system/string/TrimToTest.ts +28 -0
  42. package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +26 -0
  43. package/__tests__/engine/runtime/KIRuntimeTest.ts +351 -0
  44. package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +128 -0
  45. package/__tests__/engine/runtime/expression/ExpressionTest.ts +33 -0
  46. package/__tests__/engine/runtime/expression/tokenextractor/OutputMapTokenValueExtractorTest.ts +44 -0
  47. package/__tests__/engine/runtime/expression/tokenextractor/TokenValueExtractorTest.ts +72 -0
  48. package/__tests__/engine/util/LinkedListTest.ts +29 -0
  49. package/__tests__/engine/util/string/StringFormatterTest.ts +17 -0
  50. package/__tests__/indexTest.ts +33 -0
  51. package/dist/index.js +2 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/module.js +2 -0
  54. package/dist/module.js.map +1 -0
  55. package/dist/types.d.ts +430 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/package.json +54 -0
  58. package/src/engine/HybridRepository.ts +18 -0
  59. package/src/engine/Repository.ts +3 -0
  60. package/src/engine/constant/KIRunConstants.ts +7 -0
  61. package/src/engine/exception/ExecutionException.ts +12 -0
  62. package/src/engine/exception/KIRuntimeException.ts +12 -0
  63. package/src/engine/function/AbstractFunction.ts +76 -0
  64. package/src/engine/function/Function.ts +13 -0
  65. package/src/engine/function/system/GenerateEvent.ts +76 -0
  66. package/src/engine/function/system/If.ts +40 -0
  67. package/src/engine/function/system/array/AbstractArrayFunction.ts +158 -0
  68. package/src/engine/function/system/array/Add.ts +31 -0
  69. package/src/engine/function/system/array/AddFirst.ts +44 -0
  70. package/src/engine/function/system/array/BinarySearch.ts +66 -0
  71. package/src/engine/function/system/array/Compare.ts +150 -0
  72. package/src/engine/function/system/array/Copy.ts +56 -0
  73. package/src/engine/function/system/array/Delete.ts +63 -0
  74. package/src/engine/function/system/array/DeleteFirst.ts +22 -0
  75. package/src/engine/function/system/array/DeleteFrom.ts +51 -0
  76. package/src/engine/function/system/array/DeleteLast.ts +23 -0
  77. package/src/engine/function/system/array/Disjoint.ts +85 -0
  78. package/src/engine/function/system/array/Equals.ts +36 -0
  79. package/src/engine/function/system/array/Fill.ts +51 -0
  80. package/src/engine/function/system/array/Frequency.ts +68 -0
  81. package/src/engine/function/system/array/IndexOf.ts +56 -0
  82. package/src/engine/function/system/array/IndexOfArray.ts +67 -0
  83. package/src/engine/function/system/array/Insert.ts +48 -0
  84. package/src/engine/function/system/array/LastIndexOf.ts +62 -0
  85. package/src/engine/function/system/array/LastIndexOfArray.ts +70 -0
  86. package/src/engine/function/system/array/Max.ts +31 -0
  87. package/src/engine/function/system/array/Min.ts +32 -0
  88. package/src/engine/function/system/array/MisMatch.ts +66 -0
  89. package/src/engine/function/system/array/Reverse.ts +50 -0
  90. package/src/engine/function/system/array/Rotate.ts +43 -0
  91. package/src/engine/function/system/array/Shuffle.ts +31 -0
  92. package/src/engine/function/system/array/Sort.ts +70 -0
  93. package/src/engine/function/system/array/SubArray.ts +48 -0
  94. package/src/engine/function/system/context/Create.ts +73 -0
  95. package/src/engine/function/system/context/Get.ts +55 -0
  96. package/src/engine/function/system/context/SetFunction.ts +244 -0
  97. package/src/engine/function/system/loop/CountLoop.ts +55 -0
  98. package/src/engine/function/system/loop/RangeLoop.ts +120 -0
  99. package/src/engine/function/system/math/Add.ts +34 -0
  100. package/src/engine/function/system/math/GenericMathFunction.ts +80 -0
  101. package/src/engine/function/system/math/Hypotenuse.ts +57 -0
  102. package/src/engine/function/system/math/MathFunctionRepository.ts +63 -0
  103. package/src/engine/function/system/math/Maximum.ts +38 -0
  104. package/src/engine/function/system/math/Minimum.ts +38 -0
  105. package/src/engine/function/system/math/Random.ts +27 -0
  106. package/src/engine/function/system/string/AbstractStringFunction.ts +409 -0
  107. package/src/engine/function/system/string/Concatenate.ts +57 -0
  108. package/src/engine/function/system/string/DeleteForGivenLength.ts +82 -0
  109. package/src/engine/function/system/string/InsertAtGivenPosition.ts +72 -0
  110. package/src/engine/function/system/string/PostPad.ts +83 -0
  111. package/src/engine/function/system/string/PrePad.ts +73 -0
  112. package/src/engine/function/system/string/RegionMatches.ts +119 -0
  113. package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +101 -0
  114. package/src/engine/function/system/string/Reverse.ts +62 -0
  115. package/src/engine/function/system/string/Split.ts +53 -0
  116. package/src/engine/function/system/string/StringFunctionRepository.ts +60 -0
  117. package/src/engine/function/system/string/ToString.ts +45 -0
  118. package/src/engine/function/system/string/TrimTo.ts +55 -0
  119. package/src/engine/json/JsonExpression.ts +11 -0
  120. package/src/engine/json/schema/Schema.ts +670 -0
  121. package/src/engine/json/schema/SchemaUtil.ts +145 -0
  122. package/src/engine/json/schema/array/ArraySchemaType.ts +44 -0
  123. package/src/engine/json/schema/object/AdditionalPropertiesType.ts +32 -0
  124. package/src/engine/json/schema/string/StringFormat.ts +7 -0
  125. package/src/engine/json/schema/type/MultipleType.ts +28 -0
  126. package/src/engine/json/schema/type/SchemaType.ts +11 -0
  127. package/src/engine/json/schema/type/SingleType.ts +23 -0
  128. package/src/engine/json/schema/type/Type.ts +6 -0
  129. package/src/engine/json/schema/type/TypeUtil.ts +25 -0
  130. package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +108 -0
  131. package/src/engine/json/schema/validator/ArrayValidator.ts +145 -0
  132. package/src/engine/json/schema/validator/BooleanValidator.ts +24 -0
  133. package/src/engine/json/schema/validator/NullValidator.ts +17 -0
  134. package/src/engine/json/schema/validator/NumberValidator.ts +115 -0
  135. package/src/engine/json/schema/validator/ObjectValidator.ts +184 -0
  136. package/src/engine/json/schema/validator/SchemaValidator.ts +141 -0
  137. package/src/engine/json/schema/validator/StringValidator.ts +97 -0
  138. package/src/engine/json/schema/validator/TypeValidator.ts +49 -0
  139. package/src/engine/json/schema/validator/exception/SchemaReferenceException.ts +19 -0
  140. package/src/engine/json/schema/validator/exception/SchemaValidationException.ts +22 -0
  141. package/src/engine/model/AbstractStatement.ts +29 -0
  142. package/src/engine/model/Argument.ts +36 -0
  143. package/src/engine/model/Event.ts +62 -0
  144. package/src/engine/model/EventResult.ts +34 -0
  145. package/src/engine/model/FunctionDefinition.ts +69 -0
  146. package/src/engine/model/FunctionOutput.ts +37 -0
  147. package/src/engine/model/FunctionOutputGenerator.ts +5 -0
  148. package/src/engine/model/FunctionSignature.ts +67 -0
  149. package/src/engine/model/Parameter.ts +97 -0
  150. package/src/engine/model/ParameterReference.ts +57 -0
  151. package/src/engine/model/ParameterReferenceType.ts +4 -0
  152. package/src/engine/model/ParameterType.ts +4 -0
  153. package/src/engine/model/Position.ts +40 -0
  154. package/src/engine/model/Statement.ts +101 -0
  155. package/src/engine/model/StatementGroup.ts +37 -0
  156. package/src/engine/namespaces/Namespaces.ts +11 -0
  157. package/src/engine/repository/KIRunFunctionRepository.ts +37 -0
  158. package/src/engine/repository/KIRunSchemaRepository.ts +24 -0
  159. package/src/engine/runtime/ContextElement.ts +28 -0
  160. package/src/engine/runtime/FunctionExecutionParameters.ts +74 -0
  161. package/src/engine/runtime/KIRuntime.ts +653 -0
  162. package/src/engine/runtime/StatementExecution.ts +61 -0
  163. package/src/engine/runtime/StatementMessage.ts +30 -0
  164. package/src/engine/runtime/StatementMessageType.ts +5 -0
  165. package/src/engine/runtime/expression/Expression.ts +330 -0
  166. package/src/engine/runtime/expression/ExpressionEvaluator.ts +305 -0
  167. package/src/engine/runtime/expression/ExpressionToken.ts +15 -0
  168. package/src/engine/runtime/expression/ExpressionTokenValue.ts +23 -0
  169. package/src/engine/runtime/expression/Operation.ts +190 -0
  170. package/src/engine/runtime/expression/exception/ExpressionEvaluationException.ts +15 -0
  171. package/src/engine/runtime/expression/operators/binary/ArithmeticAdditionOperator.ts +9 -0
  172. package/src/engine/runtime/expression/operators/binary/ArithmeticDivisionOperator.ts +9 -0
  173. package/src/engine/runtime/expression/operators/binary/ArithmeticInetgerDivisionOperator.ts +9 -0
  174. package/src/engine/runtime/expression/operators/binary/ArithmeticModulusOperator.ts +9 -0
  175. package/src/engine/runtime/expression/operators/binary/ArithmeticMultiplicationOperator.ts +9 -0
  176. package/src/engine/runtime/expression/operators/binary/ArithmeticSubtractionOperator.ts +9 -0
  177. package/src/engine/runtime/expression/operators/binary/ArrayOperator.ts +31 -0
  178. package/src/engine/runtime/expression/operators/binary/BinaryOperator.ts +15 -0
  179. package/src/engine/runtime/expression/operators/binary/BitwiseAndOperator.ts +9 -0
  180. package/src/engine/runtime/expression/operators/binary/BitwiseLeftShiftOperator.ts +9 -0
  181. package/src/engine/runtime/expression/operators/binary/BitwiseOrOperator.ts +9 -0
  182. package/src/engine/runtime/expression/operators/binary/BitwiseRightShiftOperator.ts +9 -0
  183. package/src/engine/runtime/expression/operators/binary/BitwiseUnsignedRightShiftOperator.ts +9 -0
  184. package/src/engine/runtime/expression/operators/binary/BitwiseXorOperator.ts +9 -0
  185. package/src/engine/runtime/expression/operators/binary/LogicalAndOperator.ts +25 -0
  186. package/src/engine/runtime/expression/operators/binary/LogicalEqualOperator.ts +13 -0
  187. package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanEqualOperator.ts +24 -0
  188. package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanOperator.ts +24 -0
  189. package/src/engine/runtime/expression/operators/binary/LogicalLessThanEqualOperator.ts +24 -0
  190. package/src/engine/runtime/expression/operators/binary/LogicalLessThanOperator.ts +24 -0
  191. package/src/engine/runtime/expression/operators/binary/LogicalNotEqualOperator.ts +13 -0
  192. package/src/engine/runtime/expression/operators/binary/LogicalOrOperator.ts +25 -0
  193. package/src/engine/runtime/expression/operators/binary/ObjectOperator.ts +24 -0
  194. package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryMinusOperator.ts +13 -0
  195. package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryPlusOperator.ts +13 -0
  196. package/src/engine/runtime/expression/operators/unary/BitwiseComplementOperator.ts +22 -0
  197. package/src/engine/runtime/expression/operators/unary/LogicalNotOperator.ts +22 -0
  198. package/src/engine/runtime/expression/operators/unary/UnaryOperator.ts +15 -0
  199. package/src/engine/runtime/expression/tokenextractor/LiteralTokenValueExtractor.ts +64 -0
  200. package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +136 -0
  201. package/src/engine/runtime/graph/ExecutionGraph.ts +81 -0
  202. package/src/engine/runtime/graph/GraphVertex.ts +118 -0
  203. package/src/engine/runtime/graph/GraphVertexType.ts +4 -0
  204. package/src/engine/runtime/tokenextractor/ArgumentsTokenValueExtractor.ts +22 -0
  205. package/src/engine/runtime/tokenextractor/ContextTokenValueExtractor.ts +37 -0
  206. package/src/engine/runtime/tokenextractor/OutputMapTokenValueExtractor.ts +32 -0
  207. package/src/engine/util/ArrayUtil.ts +23 -0
  208. package/src/engine/util/LinkedList.ts +229 -0
  209. package/src/engine/util/MapUtil.ts +86 -0
  210. package/src/engine/util/NullCheck.ts +3 -0
  211. package/src/engine/util/Tuples.ts +43 -0
  212. package/src/engine/util/primitive/PrimitiveUtil.ts +143 -0
  213. package/src/engine/util/string/StringBuilder.ts +59 -0
  214. package/src/engine/util/string/StringFormatter.ts +25 -0
  215. package/src/engine/util/string/StringUtil.ts +48 -0
  216. package/src/index.ts +13 -0
  217. package/tsconfig.json +6 -0
@@ -0,0 +1,98 @@
1
+ import { Max } from '../../../../../src/engine/function/system/array/Max';
2
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
+
4
+ let max: Max = new Max();
5
+
6
+ test('max test 1 ', () => {
7
+ let arr: any[] = [];
8
+ arr.push(null);
9
+ arr.push(12);
10
+
11
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
12
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
13
+ );
14
+
15
+ expect(max.execute(fep).allResults()[0].getResult().get(Max.EVENT_RESULT_ANY.getName())).toBe(
16
+ 12,
17
+ );
18
+ });
19
+
20
+ test('max test 2 ', () => {
21
+ let arr: any[] = [];
22
+
23
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
24
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
25
+ );
26
+
27
+ expect(() => max.execute(fep)).toThrow();
28
+ });
29
+
30
+ test('max test 3', () => {
31
+ let arr: any[] = [];
32
+ arr.push(12);
33
+ arr.push(15);
34
+ arr.push(null);
35
+ arr.push(98);
36
+ arr.push(1);
37
+
38
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
39
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
40
+ );
41
+ expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe(98);
42
+ });
43
+
44
+ test('Max test 4', () => {
45
+ let arr: any[] = [];
46
+ arr.push('nocode');
47
+ arr.push('NoCode');
48
+ arr.push('platform');
49
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
50
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
51
+ );
52
+ expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('platform');
53
+ });
54
+
55
+ test('Max test 6', () => {
56
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
57
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), null]]),
58
+ );
59
+ expect(() => max.execute(fep)).toThrow();
60
+ });
61
+
62
+ test('Max test 5', () => {
63
+ let arr: any[] = [];
64
+
65
+ arr.push(456);
66
+ arr.push('nocode');
67
+
68
+ arr.push('NoCode');
69
+ arr.push('platform');
70
+ arr.push(123);
71
+
72
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
73
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
74
+ );
75
+ expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('platform');
76
+ });
77
+
78
+ test('Max test 7', () => {
79
+ let arr1: any[] = [];
80
+ arr1.push('c');
81
+ arr1.push('r');
82
+ arr1.push('d');
83
+ arr1.push('s');
84
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
85
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr1]]),
86
+ );
87
+
88
+ expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('s');
89
+ });
90
+
91
+ test('Max test 8', () => {
92
+ let arr: any[] = ['surendhar'];
93
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
94
+ new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
95
+ );
96
+
97
+ expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('surendhar');
98
+ });
@@ -0,0 +1,99 @@
1
+ import { Min } from '../../../../../src/engine/function/system/array/Min';
2
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
+
4
+ let min: Min = new Min();
5
+
6
+ test('min test 1 ', () => {
7
+ let arr: any[] = [];
8
+ arr.push(null);
9
+ arr.push(12);
10
+
11
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
12
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
13
+ );
14
+
15
+ expect(min.execute(fep).allResults()[0].getResult().get(Min.EVENT_RESULT_ANY.getName())).toBe(
16
+ 12,
17
+ );
18
+ });
19
+
20
+ test('min test 2 ', () => {
21
+ let arr: any[] = [];
22
+
23
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
24
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
25
+ );
26
+
27
+ expect(() => min.execute(fep)).toThrow();
28
+ });
29
+
30
+ test('min test 3', () => {
31
+ let arr: any[] = [];
32
+ arr.push(12);
33
+ arr.push(15);
34
+ arr.push(null);
35
+ arr.push(98);
36
+ arr.push(1);
37
+
38
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
39
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
40
+ );
41
+ expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe(1);
42
+ });
43
+
44
+ test('min test 4', () => {
45
+ let arr: any[] = [];
46
+ arr.push('nocode');
47
+ arr.push('NoCode');
48
+ arr.push('platform');
49
+
50
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
51
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
52
+ );
53
+ expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('NoCode');
54
+ });
55
+
56
+ test('min test 5', () => {
57
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
58
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), null]]),
59
+ );
60
+ expect(() => min.execute(fep)).toThrow();
61
+ });
62
+
63
+ test('min test 6', () => {
64
+ let arr: any[] = [];
65
+
66
+ arr.push(456);
67
+ arr.push('nocode');
68
+
69
+ arr.push('NoCode');
70
+ arr.push('platform');
71
+ arr.push(123);
72
+ arr.push(1);
73
+
74
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
75
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
76
+ );
77
+ expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe(1);
78
+ });
79
+
80
+ test('min test 7', () => {
81
+ let arr1: any[] = [];
82
+ arr1.push('c');
83
+ arr1.push('r');
84
+ arr1.push('d');
85
+ arr1.push('s');
86
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
87
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr1]]),
88
+ );
89
+
90
+ expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('c');
91
+ });
92
+
93
+ test('min test 8', () => {
94
+ let arr: any[] = ['surendhar'];
95
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
96
+ new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
97
+ );
98
+ expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('surendhar');
99
+ });
@@ -0,0 +1,215 @@
1
+ import { MisMatch } from '../../../../../src/engine/function/system/array/MisMatch';
2
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
+
4
+ let mismatch: MisMatch = new MisMatch();
5
+
6
+ test('mismatch test 1', () => {
7
+ let arr: any[] = [];
8
+ arr.push('a');
9
+ arr.push('b');
10
+ arr.push('c');
11
+ arr.push('d');
12
+ arr.push('l');
13
+ arr.push('d');
14
+ arr.push('a');
15
+ arr.push('b');
16
+ arr.push('c');
17
+ arr.push('e');
18
+ arr.push('d');
19
+
20
+ let res: any[] = [];
21
+ res.push('b');
22
+ res.push('c');
23
+ res.push('d');
24
+
25
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
26
+ new Map<string, any>([
27
+ [MisMatch.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
28
+ [MisMatch.PARAMETER_INT_FIND_FROM.getParameterName(), 7],
29
+ [MisMatch.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), res],
30
+ [MisMatch.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName(), 0],
31
+ [MisMatch.PARAMETER_INT_LENGTH.getParameterName(), 3],
32
+ ]),
33
+ );
34
+
35
+ expect(
36
+ mismatch
37
+ .execute(fep)
38
+ .allResults()[0]
39
+ .getResult()
40
+ .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
41
+ ).toBe(2);
42
+ });
43
+
44
+ test('mismatch test 2', () => {
45
+ let arr: any[] = [];
46
+ arr.push('a');
47
+ arr.push('b');
48
+ arr.push('c');
49
+ arr.push('d');
50
+ arr.push('l');
51
+ arr.push('d');
52
+ arr.push('a');
53
+ arr.push('b');
54
+ arr.push('c');
55
+ arr.push('e');
56
+ arr.push('d');
57
+
58
+ let res: any[] = [];
59
+ res.push('b');
60
+ res.push('c');
61
+ res.push('d');
62
+
63
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
64
+ new Map<string, any>([
65
+ [MisMatch.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
66
+ [MisMatch.PARAMETER_INT_FIND_FROM.getParameterName(), 0],
67
+ [MisMatch.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), res],
68
+ [MisMatch.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName(), 2],
69
+ [MisMatch.PARAMETER_INT_LENGTH.getParameterName(), 5],
70
+ ]),
71
+ );
72
+
73
+ expect(() => mismatch.execute(fep)).toThrow();
74
+ });
75
+
76
+ test('Mismatch test 3', () => {
77
+ let array1: any[] = [];
78
+ array1.push('test');
79
+ array1.push('Driven');
80
+ array1.push('developement');
81
+ array1.push('I');
82
+ array1.push('am');
83
+ array1.push('using');
84
+ array1.push('eclipse');
85
+ array1.push('I');
86
+ array1.push('to');
87
+ array1.push('test');
88
+ array1.push('the');
89
+ array1.push('changes');
90
+ array1.push('with');
91
+ array1.push('test');
92
+ array1.push('Driven');
93
+ array1.push('developement');
94
+
95
+ let array2: any[] = [];
96
+
97
+ array2.push('test');
98
+ array2.push('Driven');
99
+ array2.push('developement');
100
+ array2.push('I');
101
+ array2.push('am');
102
+ array2.push('using');
103
+ array2.push('eclipse');
104
+ array2.push('I');
105
+ array2.push('to');
106
+ array2.push('test');
107
+ array2.push('the');
108
+ array2.push('changes');
109
+ array2.push('with');
110
+
111
+ let array3: any[] = [];
112
+
113
+ array3.push('test');
114
+ array3.push('Driven');
115
+ array3.push('developement');
116
+ array3.push('I');
117
+ array3.push('am');
118
+ array3.push('using');
119
+ array3.push('eclipse');
120
+ array3.push('I');
121
+ array3.push('to');
122
+ array3.push('test');
123
+ array3.push('the');
124
+ array3.push('changes');
125
+ array3.push('with');
126
+ array3.push('test');
127
+ array3.push('Driven');
128
+ array3.push('developement');
129
+
130
+ let array4: any[] = [];
131
+ array4.push('test');
132
+ array4.push('Driven');
133
+ array4.push('developement');
134
+ array4.push('I');
135
+ array4.push('am');
136
+ array4.push('using');
137
+ array4.push('eclipse');
138
+ array4.push('I');
139
+ array4.push('to');
140
+
141
+ let arr: any[] = [];
142
+
143
+ arr.push(array2);
144
+ arr.push(array4);
145
+ arr.push(array1);
146
+ arr.push(array1);
147
+ arr.push(array1);
148
+ arr.push(array3);
149
+ arr.push(array2);
150
+ arr.push(array4);
151
+ arr.push(array1);
152
+ arr.push(array1);
153
+ arr.push(array4);
154
+
155
+ let res: any[] = [];
156
+ res.push(array1);
157
+ res.push(array1);
158
+ res.push(array4);
159
+
160
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
161
+ new Map<string, any>([
162
+ [MisMatch.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
163
+ [MisMatch.PARAMETER_INT_FIND_FROM.getParameterName(), 2],
164
+ [MisMatch.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), res],
165
+ [MisMatch.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName(), 3],
166
+ [MisMatch.PARAMETER_INT_LENGTH.getParameterName(), 3],
167
+ ]),
168
+ );
169
+
170
+ expect(
171
+ mismatch
172
+ .execute(fep)
173
+ .allResults()[0]
174
+ .getResult()
175
+ .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
176
+ ).toBe(2);
177
+ });
178
+
179
+ test('mismatch test 4', () => {
180
+ let arr: any[] = [];
181
+ arr.push('a');
182
+ arr.push('b');
183
+ arr.push('c');
184
+ arr.push('d');
185
+ arr.push('l');
186
+ arr.push('d');
187
+ arr.push('a');
188
+ arr.push('b');
189
+ arr.push('c');
190
+ arr.push('e');
191
+ arr.push('d');
192
+
193
+ let res: any[] = [];
194
+ res.push('b');
195
+ res.push('c');
196
+ res.push('d');
197
+
198
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
199
+ new Map<string, any>([
200
+ [MisMatch.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
201
+ [MisMatch.PARAMETER_INT_FIND_FROM.getParameterName(), 1],
202
+ [MisMatch.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), res],
203
+ [MisMatch.PARAMETER_INT_SECOND_SOURCE_FROM.getParameterName(), 0],
204
+ [MisMatch.PARAMETER_INT_LENGTH.getParameterName(), 3],
205
+ ]),
206
+ );
207
+
208
+ expect(
209
+ mismatch
210
+ .execute(fep)
211
+ .allResults()[0]
212
+ .getResult()
213
+ .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
214
+ ).toBe(-1);
215
+ });
@@ -0,0 +1,235 @@
1
+ import { Reverse } from '../../../../../src/engine/function/system/array/Reverse';
2
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
+
4
+ let rev: Reverse = new Reverse();
5
+
6
+ test('Reverse test 1 ', () => {
7
+ let src: any[] = [4, 5, 6, 7];
8
+
9
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
10
+ .setArguments(
11
+ new Map<string, any>([
12
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), src],
13
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 0],
14
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), 2],
15
+ ]),
16
+ )
17
+ .setContext(new Map([]))
18
+ .setSteps(new Map([]));
19
+
20
+ let res = [5, 4, 6, 7];
21
+ rev.execute(fep);
22
+ expect(src).toStrictEqual(res);
23
+ });
24
+
25
+ test('Reverse test 2 ', () => {
26
+ let src: any[] = [];
27
+
28
+ src.push('I');
29
+ src.push('am');
30
+ src.push('using');
31
+ src.push('eclipse');
32
+ src.push('to');
33
+ src.push('test');
34
+ src.push('the');
35
+ src.push('changes');
36
+ src.push('with');
37
+ src.push('test');
38
+ src.push('Driven');
39
+ src.push('developement');
40
+
41
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
42
+ .setArguments(
43
+ new Map<string, any>([
44
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), src],
45
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), -2],
46
+ ]),
47
+ )
48
+ .setContext(new Map([]))
49
+ .setSteps(new Map([]));
50
+
51
+ expect(() => rev.execute(fep)).toThrow();
52
+ });
53
+
54
+ test('Reverse test 3', () => {
55
+ let arr: any[] = [];
56
+ arr.push('a');
57
+ arr.push('b');
58
+ arr.push('c');
59
+ arr.push('d');
60
+ arr.push('a');
61
+ arr.push('b');
62
+ arr.push('c');
63
+ arr.push('d');
64
+
65
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
66
+ .setContext(new Map([]))
67
+ .setSteps(new Map([]));
68
+
69
+ fep.setArguments(
70
+ new Map<string, any>([
71
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
72
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 2],
73
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), arr.length],
74
+ ]),
75
+ );
76
+ expect(() => rev.execute(fep)).toThrow();
77
+ });
78
+
79
+ test('Rev test 4', () => {
80
+ let array1: any[] = [];
81
+ array1.push('test');
82
+ array1.push('Driven');
83
+ array1.push('developement');
84
+ array1.push('I');
85
+ array1.push('am');
86
+ array1.push('using');
87
+ array1.push('eclipse');
88
+ array1.push('I');
89
+ array1.push('to');
90
+ array1.push('test');
91
+ array1.push('the');
92
+ array1.push('changes');
93
+ array1.push('with');
94
+ array1.push('test');
95
+ array1.push('Driven');
96
+ array1.push('developement');
97
+
98
+ let array2: any[] = [];
99
+ array2.push('test');
100
+ array2.push('Driven');
101
+ array2.push('developement');
102
+ array2.push('I');
103
+ array2.push('am');
104
+ array2.push('using');
105
+ array2.push('eclipse');
106
+ array2.push('I');
107
+ array2.push('to');
108
+ array2.push('test');
109
+ array2.push('the');
110
+ array2.push('changes');
111
+ array2.push('with');
112
+
113
+ let array3: any[] = [];
114
+ array3.push('test');
115
+ array3.push('Driven');
116
+ array3.push('developement');
117
+ array3.push('I');
118
+ array3.push('am');
119
+ array3.push('using');
120
+ array3.push('eclipse');
121
+ array3.push('I');
122
+ array3.push('to');
123
+ array3.push('test');
124
+ array3.push('the');
125
+ array3.push('changes');
126
+ array3.push('with');
127
+ array3.push('test');
128
+ array3.push('Driven');
129
+ array3.push('developement');
130
+
131
+ let array4: any[] = [];
132
+ array4.push('test');
133
+ array4.push('Driven');
134
+ array4.push('developement');
135
+ array4.push('I');
136
+ array4.push('am');
137
+ array4.push('using');
138
+ array4.push('eclipse');
139
+ array4.push('I');
140
+ array4.push('to');
141
+
142
+ let arr: any[] = [];
143
+ arr.push(array1);
144
+ arr.push(array3);
145
+ arr.push(array2);
146
+ arr.push(array4);
147
+ arr.push(array1);
148
+
149
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
150
+ .setArguments(
151
+ new Map<string, any>([
152
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
153
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 1],
154
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), arr.length - 2],
155
+ ]),
156
+ )
157
+ .setContext(new Map([]))
158
+ .setSteps(new Map([]));
159
+
160
+ let res: any[] = [];
161
+ res.push(array1);
162
+ res.push(array4);
163
+ res.push(array2);
164
+ res.push(array3);
165
+ res.push(array1);
166
+
167
+ rev.execute(fep);
168
+
169
+ expect(arr).toStrictEqual(res);
170
+
171
+ fep.setArguments(
172
+ new Map<string, any>([
173
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
174
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 1],
175
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), arr.length - 1],
176
+ ]),
177
+ );
178
+
179
+ let res1: any[] = [];
180
+ res1.push(array1);
181
+ res1.push(array1);
182
+ res1.push(array3);
183
+ res1.push(array2);
184
+ res1.push(array4);
185
+
186
+ rev.execute(fep);
187
+ expect(arr).toStrictEqual(res1);
188
+ });
189
+
190
+ test('rev test 5', () => {
191
+ let arr: any[] = [];
192
+ arr.push('a');
193
+ arr.push('b');
194
+ arr.push('a');
195
+ arr.push('c');
196
+ arr.push('d');
197
+ arr.push('a');
198
+ arr.push('b');
199
+ arr.push('c');
200
+ arr.push('d');
201
+
202
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
203
+ .setArguments(
204
+ new Map<string, any>([
205
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
206
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 2],
207
+ ]),
208
+ )
209
+ .setContext(new Map([]))
210
+ .setSteps(new Map([]));
211
+
212
+ let res: any[] = [];
213
+ res.push('a');
214
+ res.push('b');
215
+ res.push('d');
216
+ res.push('c');
217
+ res.push('b');
218
+ res.push('a');
219
+ res.push('d');
220
+ res.push('c');
221
+ res.push('a');
222
+
223
+ rev.execute(fep);
224
+ expect(arr).toStrictEqual(res);
225
+
226
+ fep.setArguments(
227
+ new Map<string, any>([
228
+ [Reverse.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
229
+ [Reverse.PARAMETER_INT_SOURCE_FROM.getParameterName(), 2],
230
+ [Reverse.PARAMETER_INT_LENGTH.getParameterName(), arr.length],
231
+ ]),
232
+ );
233
+
234
+ expect(() => rev.execute(fep)).toThrow();
235
+ });