@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.
- package/.prettierrc +9 -0
- package/__tests__/engine/function/system/array/AddFirstTest.ts +235 -0
- package/__tests__/engine/function/system/array/AddTest.ts +126 -0
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +135 -0
- package/__tests__/engine/function/system/array/CompareTest.ts +48 -0
- package/__tests__/engine/function/system/array/CopyTest.ts +86 -0
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +232 -0
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteTest.ts +110 -0
- package/__tests__/engine/function/system/array/DisjointTest.ts +184 -0
- package/__tests__/engine/function/system/array/Equals.ts +67 -0
- package/__tests__/engine/function/system/array/FillTest.ts +36 -0
- package/__tests__/engine/function/system/array/FrequencyTest.ts +97 -0
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +347 -0
- package/__tests__/engine/function/system/array/IndexOfTest.ts +267 -0
- package/__tests__/engine/function/system/array/InsertTest.ts +229 -0
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +213 -0
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +253 -0
- package/__tests__/engine/function/system/array/MaxTest.ts +98 -0
- package/__tests__/engine/function/system/array/MinTest.ts +99 -0
- package/__tests__/engine/function/system/array/MisMatchTest.ts +215 -0
- package/__tests__/engine/function/system/array/ReverseTest.ts +235 -0
- package/__tests__/engine/function/system/array/RotateTest.ts +137 -0
- package/__tests__/engine/function/system/array/ShuffleTest.ts +154 -0
- package/__tests__/engine/function/system/array/SortTest.ts +130 -0
- package/__tests__/engine/function/system/array/SubArrayTest.ts +236 -0
- package/__tests__/engine/function/system/math/AddTest.ts +12 -0
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +46 -0
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +38 -0
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +53 -0
- package/__tests__/engine/function/system/string/PostPadTest.ts +54 -0
- package/__tests__/engine/function/system/string/PrePadTest.ts +54 -0
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +78 -0
- package/__tests__/engine/function/system/string/ReverseTest.ts +36 -0
- package/__tests__/engine/function/system/string/SplitTest.ts +61 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +126 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +54 -0
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +146 -0
- package/__tests__/engine/function/system/string/ToStringTest.ts +43 -0
- package/__tests__/engine/function/system/string/TrimToTest.ts +28 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +26 -0
- package/__tests__/engine/runtime/KIRuntimeTest.ts +351 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +128 -0
- package/__tests__/engine/runtime/expression/ExpressionTest.ts +33 -0
- package/__tests__/engine/runtime/expression/tokenextractor/OutputMapTokenValueExtractorTest.ts +44 -0
- package/__tests__/engine/runtime/expression/tokenextractor/TokenValueExtractorTest.ts +72 -0
- package/__tests__/engine/util/LinkedListTest.ts +29 -0
- package/__tests__/engine/util/string/StringFormatterTest.ts +17 -0
- package/__tests__/indexTest.ts +33 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +430 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +54 -0
- package/src/engine/HybridRepository.ts +18 -0
- package/src/engine/Repository.ts +3 -0
- package/src/engine/constant/KIRunConstants.ts +7 -0
- package/src/engine/exception/ExecutionException.ts +12 -0
- package/src/engine/exception/KIRuntimeException.ts +12 -0
- package/src/engine/function/AbstractFunction.ts +76 -0
- package/src/engine/function/Function.ts +13 -0
- package/src/engine/function/system/GenerateEvent.ts +76 -0
- package/src/engine/function/system/If.ts +40 -0
- package/src/engine/function/system/array/AbstractArrayFunction.ts +158 -0
- package/src/engine/function/system/array/Add.ts +31 -0
- package/src/engine/function/system/array/AddFirst.ts +44 -0
- package/src/engine/function/system/array/BinarySearch.ts +66 -0
- package/src/engine/function/system/array/Compare.ts +150 -0
- package/src/engine/function/system/array/Copy.ts +56 -0
- package/src/engine/function/system/array/Delete.ts +63 -0
- package/src/engine/function/system/array/DeleteFirst.ts +22 -0
- package/src/engine/function/system/array/DeleteFrom.ts +51 -0
- package/src/engine/function/system/array/DeleteLast.ts +23 -0
- package/src/engine/function/system/array/Disjoint.ts +85 -0
- package/src/engine/function/system/array/Equals.ts +36 -0
- package/src/engine/function/system/array/Fill.ts +51 -0
- package/src/engine/function/system/array/Frequency.ts +68 -0
- package/src/engine/function/system/array/IndexOf.ts +56 -0
- package/src/engine/function/system/array/IndexOfArray.ts +67 -0
- package/src/engine/function/system/array/Insert.ts +48 -0
- package/src/engine/function/system/array/LastIndexOf.ts +62 -0
- package/src/engine/function/system/array/LastIndexOfArray.ts +70 -0
- package/src/engine/function/system/array/Max.ts +31 -0
- package/src/engine/function/system/array/Min.ts +32 -0
- package/src/engine/function/system/array/MisMatch.ts +66 -0
- package/src/engine/function/system/array/Reverse.ts +50 -0
- package/src/engine/function/system/array/Rotate.ts +43 -0
- package/src/engine/function/system/array/Shuffle.ts +31 -0
- package/src/engine/function/system/array/Sort.ts +70 -0
- package/src/engine/function/system/array/SubArray.ts +48 -0
- package/src/engine/function/system/context/Create.ts +73 -0
- package/src/engine/function/system/context/Get.ts +55 -0
- package/src/engine/function/system/context/SetFunction.ts +244 -0
- package/src/engine/function/system/loop/CountLoop.ts +55 -0
- package/src/engine/function/system/loop/RangeLoop.ts +120 -0
- package/src/engine/function/system/math/Add.ts +34 -0
- package/src/engine/function/system/math/GenericMathFunction.ts +80 -0
- package/src/engine/function/system/math/Hypotenuse.ts +57 -0
- package/src/engine/function/system/math/MathFunctionRepository.ts +63 -0
- package/src/engine/function/system/math/Maximum.ts +38 -0
- package/src/engine/function/system/math/Minimum.ts +38 -0
- package/src/engine/function/system/math/Random.ts +27 -0
- package/src/engine/function/system/string/AbstractStringFunction.ts +409 -0
- package/src/engine/function/system/string/Concatenate.ts +57 -0
- package/src/engine/function/system/string/DeleteForGivenLength.ts +82 -0
- package/src/engine/function/system/string/InsertAtGivenPosition.ts +72 -0
- package/src/engine/function/system/string/PostPad.ts +83 -0
- package/src/engine/function/system/string/PrePad.ts +73 -0
- package/src/engine/function/system/string/RegionMatches.ts +119 -0
- package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +101 -0
- package/src/engine/function/system/string/Reverse.ts +62 -0
- package/src/engine/function/system/string/Split.ts +53 -0
- package/src/engine/function/system/string/StringFunctionRepository.ts +60 -0
- package/src/engine/function/system/string/ToString.ts +45 -0
- package/src/engine/function/system/string/TrimTo.ts +55 -0
- package/src/engine/json/JsonExpression.ts +11 -0
- package/src/engine/json/schema/Schema.ts +670 -0
- package/src/engine/json/schema/SchemaUtil.ts +145 -0
- package/src/engine/json/schema/array/ArraySchemaType.ts +44 -0
- package/src/engine/json/schema/object/AdditionalPropertiesType.ts +32 -0
- package/src/engine/json/schema/string/StringFormat.ts +7 -0
- package/src/engine/json/schema/type/MultipleType.ts +28 -0
- package/src/engine/json/schema/type/SchemaType.ts +11 -0
- package/src/engine/json/schema/type/SingleType.ts +23 -0
- package/src/engine/json/schema/type/Type.ts +6 -0
- package/src/engine/json/schema/type/TypeUtil.ts +25 -0
- package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +108 -0
- package/src/engine/json/schema/validator/ArrayValidator.ts +145 -0
- package/src/engine/json/schema/validator/BooleanValidator.ts +24 -0
- package/src/engine/json/schema/validator/NullValidator.ts +17 -0
- package/src/engine/json/schema/validator/NumberValidator.ts +115 -0
- package/src/engine/json/schema/validator/ObjectValidator.ts +184 -0
- package/src/engine/json/schema/validator/SchemaValidator.ts +141 -0
- package/src/engine/json/schema/validator/StringValidator.ts +97 -0
- package/src/engine/json/schema/validator/TypeValidator.ts +49 -0
- package/src/engine/json/schema/validator/exception/SchemaReferenceException.ts +19 -0
- package/src/engine/json/schema/validator/exception/SchemaValidationException.ts +22 -0
- package/src/engine/model/AbstractStatement.ts +29 -0
- package/src/engine/model/Argument.ts +36 -0
- package/src/engine/model/Event.ts +62 -0
- package/src/engine/model/EventResult.ts +34 -0
- package/src/engine/model/FunctionDefinition.ts +69 -0
- package/src/engine/model/FunctionOutput.ts +37 -0
- package/src/engine/model/FunctionOutputGenerator.ts +5 -0
- package/src/engine/model/FunctionSignature.ts +67 -0
- package/src/engine/model/Parameter.ts +97 -0
- package/src/engine/model/ParameterReference.ts +57 -0
- package/src/engine/model/ParameterReferenceType.ts +4 -0
- package/src/engine/model/ParameterType.ts +4 -0
- package/src/engine/model/Position.ts +40 -0
- package/src/engine/model/Statement.ts +101 -0
- package/src/engine/model/StatementGroup.ts +37 -0
- package/src/engine/namespaces/Namespaces.ts +11 -0
- package/src/engine/repository/KIRunFunctionRepository.ts +37 -0
- package/src/engine/repository/KIRunSchemaRepository.ts +24 -0
- package/src/engine/runtime/ContextElement.ts +28 -0
- package/src/engine/runtime/FunctionExecutionParameters.ts +74 -0
- package/src/engine/runtime/KIRuntime.ts +653 -0
- package/src/engine/runtime/StatementExecution.ts +61 -0
- package/src/engine/runtime/StatementMessage.ts +30 -0
- package/src/engine/runtime/StatementMessageType.ts +5 -0
- package/src/engine/runtime/expression/Expression.ts +330 -0
- package/src/engine/runtime/expression/ExpressionEvaluator.ts +305 -0
- package/src/engine/runtime/expression/ExpressionToken.ts +15 -0
- package/src/engine/runtime/expression/ExpressionTokenValue.ts +23 -0
- package/src/engine/runtime/expression/Operation.ts +190 -0
- package/src/engine/runtime/expression/exception/ExpressionEvaluationException.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticAdditionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticInetgerDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticModulusOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticMultiplicationOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticSubtractionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArrayOperator.ts +31 -0
- package/src/engine/runtime/expression/operators/binary/BinaryOperator.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseAndOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseLeftShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseOrOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseUnsignedRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseXorOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/LogicalAndOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/LogicalEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalNotEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalOrOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/ObjectOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryMinusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryPlusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/BitwiseComplementOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/LogicalNotOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/UnaryOperator.ts +15 -0
- package/src/engine/runtime/expression/tokenextractor/LiteralTokenValueExtractor.ts +64 -0
- package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +136 -0
- package/src/engine/runtime/graph/ExecutionGraph.ts +81 -0
- package/src/engine/runtime/graph/GraphVertex.ts +118 -0
- package/src/engine/runtime/graph/GraphVertexType.ts +4 -0
- package/src/engine/runtime/tokenextractor/ArgumentsTokenValueExtractor.ts +22 -0
- package/src/engine/runtime/tokenextractor/ContextTokenValueExtractor.ts +37 -0
- package/src/engine/runtime/tokenextractor/OutputMapTokenValueExtractor.ts +32 -0
- package/src/engine/util/ArrayUtil.ts +23 -0
- package/src/engine/util/LinkedList.ts +229 -0
- package/src/engine/util/MapUtil.ts +86 -0
- package/src/engine/util/NullCheck.ts +3 -0
- package/src/engine/util/Tuples.ts +43 -0
- package/src/engine/util/primitive/PrimitiveUtil.ts +143 -0
- package/src/engine/util/string/StringBuilder.ts +59 -0
- package/src/engine/util/string/StringFormatter.ts +25 -0
- package/src/engine/util/string/StringUtil.ts +48 -0
- package/src/index.ts +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Concatenate } from '../../../../../src/engine/function/system/string/Concatenate';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const cat: Concatenate = new Concatenate();
|
|
6
|
+
|
|
7
|
+
test('conatenate test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
|
|
10
|
+
let array: string[] = [];
|
|
11
|
+
array.push('I ');
|
|
12
|
+
array.push('am ');
|
|
13
|
+
array.push('using ');
|
|
14
|
+
array.push('eclipse ');
|
|
15
|
+
array.push('to ');
|
|
16
|
+
array.push('test ');
|
|
17
|
+
array.push('the ');
|
|
18
|
+
array.push('changes ');
|
|
19
|
+
array.push('with ');
|
|
20
|
+
array.push('test ');
|
|
21
|
+
array.push('Driven ');
|
|
22
|
+
array.push('developement');
|
|
23
|
+
|
|
24
|
+
fep.setArguments(MapUtil.of('value', array));
|
|
25
|
+
|
|
26
|
+
expect(cat.execute(fep).allResults()[0].getResult().get('value')).toBe(
|
|
27
|
+
'I am using eclipse to test the changes with test Driven developement',
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('conatenate test2', () => {
|
|
32
|
+
let list: string[] = [];
|
|
33
|
+
list.push('no code ');
|
|
34
|
+
list.push(' Kirun ');
|
|
35
|
+
list.push(' true ');
|
|
36
|
+
list.push('"\'this is between the strings qith special characters\'"');
|
|
37
|
+
list.push(' PLATform ');
|
|
38
|
+
list.push('2');
|
|
39
|
+
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
41
|
+
|
|
42
|
+
fep.setArguments(MapUtil.of('value', list));
|
|
43
|
+
expect(cat.execute(fep).allResults()[0].getResult().get('value')).toBe(
|
|
44
|
+
'no code Kirun true "\'this is between the strings qith special characters\'" PLATform 2',
|
|
45
|
+
);
|
|
46
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DeleteForGivenLength } from '../../../../../src/engine/function/system/string/DeleteForGivenLength';
|
|
2
|
+
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
5
|
+
|
|
6
|
+
const deleteT: DeleteForGivenLength = new DeleteForGivenLength();
|
|
7
|
+
|
|
8
|
+
test('DeleteForGivenLength test1', () => {
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
10
|
+
|
|
11
|
+
fep.setArguments(
|
|
12
|
+
new Map<string, string | number>([
|
|
13
|
+
[DeleteForGivenLength.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
14
|
+
[DeleteForGivenLength.PARAMETER_AT_START_NAME, 10],
|
|
15
|
+
[DeleteForGivenLength.PARAMETER_AT_END_NAME, 18],
|
|
16
|
+
]),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
let outputString: string = ' THIScompaNOcoDE plATFNORM';
|
|
20
|
+
|
|
21
|
+
expect(deleteT.execute(fep).allResults()[0].getResult().get('result')).toBe(outputString);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('DeleteForGivenLength test2', () => {
|
|
25
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
26
|
+
|
|
27
|
+
fep.setArguments(
|
|
28
|
+
new Map<string, string | number>([
|
|
29
|
+
[DeleteForGivenLength.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
30
|
+
[DeleteForGivenLength.PARAMETER_AT_START_NAME, 4],
|
|
31
|
+
[DeleteForGivenLength.PARAMETER_AT_END_NAME, 10],
|
|
32
|
+
]),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
let outputString: string = ' THItY IS A NOcoDE plATFNORM';
|
|
36
|
+
|
|
37
|
+
expect(deleteT.execute(fep).allResults()[0].getResult().get('result')).toBe(outputString);
|
|
38
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InsertAtGivenPosition } from '../../../../../src/engine/function/system/string/InsertATGivenPosition';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const reve: InsertAtGivenPosition = new InsertAtGivenPosition();
|
|
6
|
+
|
|
7
|
+
test('InsertATGivenPositions test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
|
|
10
|
+
fep.setArguments(
|
|
11
|
+
new Map<string, string | number>([
|
|
12
|
+
[InsertAtGivenPosition.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
13
|
+
[InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME, 6],
|
|
14
|
+
[InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME, 'surendhar'],
|
|
15
|
+
]),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
let padded: string = ' THIScsurendharompatY IS A NOcoDE plATFNORM';
|
|
19
|
+
|
|
20
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(padded);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('InsertATGivenPositions test2', () => {
|
|
24
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
25
|
+
|
|
26
|
+
fep.setArguments(
|
|
27
|
+
new Map<string, string | number>([
|
|
28
|
+
[InsertAtGivenPosition.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
29
|
+
[InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME, 6],
|
|
30
|
+
[InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME, 'surendhar'],
|
|
31
|
+
]),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let padded: string = ' THIScsurendharompatY IS A NOcoDE plATFNORM';
|
|
35
|
+
|
|
36
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(padded);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('InsertATGivenPositions test3', () => {
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
41
|
+
|
|
42
|
+
fep.setArguments(
|
|
43
|
+
new Map<string, string | number>([
|
|
44
|
+
[InsertAtGivenPosition.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
45
|
+
[InsertAtGivenPosition.PARAMETER_AT_POSITION_NAME, 29],
|
|
46
|
+
[InsertAtGivenPosition.PARAMETER_INSERT_STRING_NAME, 'surendhar'],
|
|
47
|
+
]),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
let padded: string = ' THIScompatY IS A NOcoDE plATsurendharFNORM';
|
|
51
|
+
|
|
52
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(padded);
|
|
53
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PostPad } from '../../../../../src/engine/function/system/string/PostPad';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const reve: PostPad = new PostPad();
|
|
6
|
+
|
|
7
|
+
test('postpad test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
|
|
10
|
+
fep.setArguments(
|
|
11
|
+
new Map<string, string | number>([
|
|
12
|
+
['string', ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
13
|
+
['postpadString', 'hiran'],
|
|
14
|
+
['length', 12],
|
|
15
|
+
]),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
let padded: string = ' THIScompatY IS A NOcoDE plATFNORMhiranhiranhi';
|
|
19
|
+
|
|
20
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(padded);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('postpad test2', () => {
|
|
24
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
25
|
+
|
|
26
|
+
fep.setArguments(
|
|
27
|
+
new Map<string, string | number>([
|
|
28
|
+
['string', ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
29
|
+
['postpadString', ' h '],
|
|
30
|
+
['length', 15],
|
|
31
|
+
]),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let reveresed: string = ' THIScompatY IS A NOcoDE plATFNORM h h h h h ';
|
|
35
|
+
|
|
36
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(reveresed);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('postpad test3', () => {
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
41
|
+
|
|
42
|
+
fep.setArguments(
|
|
43
|
+
new Map<string, string | number>([
|
|
44
|
+
['string', ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
45
|
+
['postpadString', ' surendhar '],
|
|
46
|
+
['length', 100],
|
|
47
|
+
]),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
let reveresed: string =
|
|
51
|
+
' THIScompatY IS A NOcoDE plATFNORM surendhar surendhar surendhar surendhar surendhar surendhar surendhar surendhar surendhar ';
|
|
52
|
+
|
|
53
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('result')).toBe(reveresed);
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PrePad } from '../../../../../src/engine/function/system/string/PrePad';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const prepad: PrePad = new PrePad();
|
|
6
|
+
|
|
7
|
+
test('prepad test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
|
|
10
|
+
fep.setArguments(
|
|
11
|
+
new Map<string, string | number>([
|
|
12
|
+
[PrePad.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
13
|
+
[PrePad.PARAMETER_PREPAD_STRING_NAME, 'hiran'],
|
|
14
|
+
[PrePad.PARAMETER_LENGTH_NAME, 12],
|
|
15
|
+
]),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
let padded: string = 'hiranhiranhi THIScompatY IS A NOcoDE plATFNORM';
|
|
19
|
+
|
|
20
|
+
expect(prepad.execute(fep).allResults()[0].getResult().get(PrePad.EVENT_RESULT_NAME)).toBe(
|
|
21
|
+
padded,
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('prepad test2', () => {
|
|
26
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
27
|
+
|
|
28
|
+
fep.setArguments(
|
|
29
|
+
new Map<string, string | number>([
|
|
30
|
+
[PrePad.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
31
|
+
[PrePad.PARAMETER_PREPAD_STRING_NAME, ' h '],
|
|
32
|
+
[PrePad.PARAMETER_LENGTH_NAME, 11],
|
|
33
|
+
]),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
let padded: string = ' h h h h THIScompatY IS A NOcoDE plATFNORM';
|
|
37
|
+
|
|
38
|
+
expect(prepad.execute(fep).allResults()[0].getResult().get('result')).toBe(padded);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('prepad test3', () => {
|
|
42
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
43
|
+
|
|
44
|
+
fep.setArguments(
|
|
45
|
+
new Map<string, string | number>([
|
|
46
|
+
[PrePad.PARAMETER_STRING_NAME, ' THIScompatY IS A NOcoDE plATFNORM'],
|
|
47
|
+
[PrePad.PARAMETER_PREPAD_STRING_NAME, 'hiran'],
|
|
48
|
+
[PrePad.PARAMETER_LENGTH_NAME, 4],
|
|
49
|
+
]),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
let reveresed: string = 'hira THIScompatY IS A NOcoDE plATFNORM';
|
|
53
|
+
expect(prepad.execute(fep).allResults()[0].getResult().get('result')).toBe(reveresed);
|
|
54
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { RegionMatches } from '../../../../../src/engine/function/system/string/RegionMatches';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const region: RegionMatches = new RegionMatches();
|
|
6
|
+
|
|
7
|
+
test('toString test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
|
|
10
|
+
fep.setArguments(
|
|
11
|
+
MapUtil.of<string, string | number | boolean>(
|
|
12
|
+
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
13
|
+
true,
|
|
14
|
+
RegionMatches.PARAMETER_STRING_NAME,
|
|
15
|
+
' THIScompatY IS A NOcoDE plATFNORM',
|
|
16
|
+
RegionMatches.PARAMETER_FIRST_OFFSET_NAME,
|
|
17
|
+
5,
|
|
18
|
+
RegionMatches.PARAMETER_OTHER_STRING_NAME,
|
|
19
|
+
' fincitY compatY ',
|
|
20
|
+
RegionMatches.PARAMETER_SECOND_OFFSET_NAME,
|
|
21
|
+
9,
|
|
22
|
+
RegionMatches.PARAMETER_INTEGER_NAME,
|
|
23
|
+
7,
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
expect(
|
|
28
|
+
region.execute(fep).allResults()[0].getResult().get(RegionMatches.EVENT_RESULT_NAME),
|
|
29
|
+
).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('toString test2', () => {
|
|
33
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
34
|
+
fep.setArguments(
|
|
35
|
+
MapUtil.of<string, string | number | boolean>(
|
|
36
|
+
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
37
|
+
false,
|
|
38
|
+
RegionMatches.PARAMETER_STRING_NAME,
|
|
39
|
+
' THIScompatY IS A NOcoDE plATFNORM',
|
|
40
|
+
RegionMatches.PARAMETER_FIRST_OFFSET_NAME,
|
|
41
|
+
5,
|
|
42
|
+
RegionMatches.PARAMETER_OTHER_STRING_NAME,
|
|
43
|
+
' fincitY compatY ',
|
|
44
|
+
RegionMatches.PARAMETER_SECOND_OFFSET_NAME,
|
|
45
|
+
1,
|
|
46
|
+
RegionMatches.PARAMETER_INTEGER_NAME,
|
|
47
|
+
7,
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
region.execute(fep).allResults()[0].getResult().get(RegionMatches.EVENT_RESULT_NAME),
|
|
53
|
+
).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('toString test3', () => {
|
|
57
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
58
|
+
fep.setArguments(
|
|
59
|
+
MapUtil.of<string, string | number | boolean>(
|
|
60
|
+
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
61
|
+
true,
|
|
62
|
+
RegionMatches.PARAMETER_STRING_NAME,
|
|
63
|
+
' THIScompatY IS A NOcoDE plATFNORM',
|
|
64
|
+
RegionMatches.PARAMETER_FIRST_OFFSET_NAME,
|
|
65
|
+
10,
|
|
66
|
+
RegionMatches.PARAMETER_OTHER_STRING_NAME,
|
|
67
|
+
' fincitY compatY ',
|
|
68
|
+
RegionMatches.PARAMETER_SECOND_OFFSET_NAME,
|
|
69
|
+
6,
|
|
70
|
+
RegionMatches.PARAMETER_INTEGER_NAME,
|
|
71
|
+
3,
|
|
72
|
+
),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(
|
|
76
|
+
region.execute(fep).allResults()[0].getResult().get(RegionMatches.EVENT_RESULT_NAME),
|
|
77
|
+
).toBe(true);
|
|
78
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Reverse } from '../../../../../src/engine/function/system/string/Reverse';
|
|
2
|
+
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
5
|
+
|
|
6
|
+
const reve: Reverse = new Reverse();
|
|
7
|
+
|
|
8
|
+
test('reverse test1', () => {
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
10
|
+
|
|
11
|
+
fep.setArguments(MapUtil.of('value', ' mr"ofta"lp edoc on a si sihT'));
|
|
12
|
+
|
|
13
|
+
let reveresed: string = 'This is a no code pl"atfo"rm ';
|
|
14
|
+
|
|
15
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('value')).toBe(reveresed);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('reverse test2', () => {
|
|
19
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
20
|
+
|
|
21
|
+
fep.setArguments(MapUtil.of('value', ' '));
|
|
22
|
+
|
|
23
|
+
let reveresed: string = ' ';
|
|
24
|
+
|
|
25
|
+
expect(reve.execute(fep).allResults()[0].getResult().get('value')).toBe(reveresed);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// test('reverse test3', () => {
|
|
29
|
+
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
30
|
+
|
|
31
|
+
// fep.setArguments(MapUtil.of('value', null));
|
|
32
|
+
|
|
33
|
+
// let reveresed: string = ' ';
|
|
34
|
+
|
|
35
|
+
// expect(reve.execute(fep).allResults()[0].getResult().get('value')).toBe(reveresed);
|
|
36
|
+
// });
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Split } from '../../../../../src/engine/function/system/string/Split';
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
|
|
5
|
+
const Spli: Split = new Split();
|
|
6
|
+
|
|
7
|
+
test('split test1', () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
9
|
+
fep.setArguments(
|
|
10
|
+
MapUtil.of(
|
|
11
|
+
'string',
|
|
12
|
+
'I am using eclipse to test the changes with test Driven developement',
|
|
13
|
+
'searchString',
|
|
14
|
+
' ',
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
let array: string[] = [];
|
|
19
|
+
array.push('I');
|
|
20
|
+
array.push('am');
|
|
21
|
+
array.push('using');
|
|
22
|
+
array.push('eclipse');
|
|
23
|
+
array.push('to');
|
|
24
|
+
array.push('test');
|
|
25
|
+
array.push('the');
|
|
26
|
+
array.push('changes');
|
|
27
|
+
array.push('with');
|
|
28
|
+
array.push('test');
|
|
29
|
+
array.push('Driven');
|
|
30
|
+
array.push('developement');
|
|
31
|
+
|
|
32
|
+
expect(Spli.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(array);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('split test2', () => {
|
|
36
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
37
|
+
fep.setArguments(
|
|
38
|
+
MapUtil.of(
|
|
39
|
+
'string',
|
|
40
|
+
'I am using eclipse to test the changes with test Driven developement',
|
|
41
|
+
'searchString',
|
|
42
|
+
'e',
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
let array: string[] = [];
|
|
47
|
+
array.push('I am using ');
|
|
48
|
+
array.push('clips');
|
|
49
|
+
array.push(' to t');
|
|
50
|
+
array.push('st th');
|
|
51
|
+
array.push(' chang');
|
|
52
|
+
array.push('s with t');
|
|
53
|
+
array.push('st Driv');
|
|
54
|
+
array.push('n d');
|
|
55
|
+
array.push('v');
|
|
56
|
+
array.push('lop');
|
|
57
|
+
array.push('m');
|
|
58
|
+
array.push('nt');
|
|
59
|
+
|
|
60
|
+
expect(Spli.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(array);
|
|
61
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
2
|
+
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
3
|
+
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
|
|
7
|
+
const stringRepo = new StringFunctionRepository();
|
|
8
|
+
|
|
9
|
+
test('StringRepo - contains', () => {
|
|
10
|
+
let fun = stringRepo.find(Namespaces.STRING, 'Contains');
|
|
11
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
12
|
+
|
|
13
|
+
if (!fun) {
|
|
14
|
+
throw new Error('Function not available');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fep.setArguments(
|
|
18
|
+
MapUtil.of(
|
|
19
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
20
|
+
' no code Kirun PLATform ',
|
|
21
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
22
|
+
'no code',
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
expect(
|
|
26
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
27
|
+
).toBe(true);
|
|
28
|
+
|
|
29
|
+
fep.setArguments(
|
|
30
|
+
MapUtil.of(
|
|
31
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
32
|
+
' ',
|
|
33
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
34
|
+
' ',
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
expect(
|
|
38
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
39
|
+
).toBe(true);
|
|
40
|
+
|
|
41
|
+
fep.setArguments(
|
|
42
|
+
MapUtil.of(
|
|
43
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
44
|
+
'{20934 123 1[[23 245-0 34\\\\\\" 3434 \\\\\\" 123]]}',
|
|
45
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
46
|
+
'4 123 1[[23 245-0 34',
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
expect(
|
|
51
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
52
|
+
).toBe(true);
|
|
53
|
+
|
|
54
|
+
fep.setArguments(
|
|
55
|
+
MapUtil.of(
|
|
56
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
57
|
+
'{20934 123 1[[23 245-0 34\\\\\\" 3434 \\\\\\" 123]]}',
|
|
58
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
59
|
+
'2093(.*)',
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
expect(
|
|
64
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
65
|
+
).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('string function repo 2', () => {
|
|
69
|
+
let fun = stringRepo.find(Namespaces.STRING, 'EndsWith');
|
|
70
|
+
|
|
71
|
+
if (!fun) {
|
|
72
|
+
throw new Error('Function not available');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
76
|
+
fep.setArguments(
|
|
77
|
+
MapUtil.of(
|
|
78
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
79
|
+
' no code Kirun PLATform ',
|
|
80
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
81
|
+
'PLATform ',
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
expect(
|
|
85
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
86
|
+
).toBe(true);
|
|
87
|
+
|
|
88
|
+
fep.setArguments(
|
|
89
|
+
MapUtil.of(
|
|
90
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
91
|
+
'this is a new job\t',
|
|
92
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
93
|
+
'job\t',
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(
|
|
98
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
99
|
+
).toBe(true);
|
|
100
|
+
|
|
101
|
+
fep.setArguments(
|
|
102
|
+
MapUtil.of(
|
|
103
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
104
|
+
'{20934 123 1[[23 245-0 34\\\\\\" 3434 \\\\\\" 123]]}',
|
|
105
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
106
|
+
'" 123]]}',
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
expect(
|
|
111
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
112
|
+
).toBe(true);
|
|
113
|
+
|
|
114
|
+
fep.setArguments(
|
|
115
|
+
MapUtil.of(
|
|
116
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
117
|
+
'{20934 123 1[[23 245-0 34\\\\\\" 3434 \\\\\\" 123]]}',
|
|
118
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
119
|
+
']]20934}',
|
|
120
|
+
),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
expect(
|
|
124
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
125
|
+
).toBe(false);
|
|
126
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
2
|
+
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
3
|
+
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
|
|
7
|
+
const stringRepo = new StringFunctionRepository();
|
|
8
|
+
|
|
9
|
+
test('StringRepo3 - EqualsIgnoreCase', () => {
|
|
10
|
+
let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
|
|
11
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
12
|
+
|
|
13
|
+
if (!fun) {
|
|
14
|
+
throw new Error('Function not available');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fep.setArguments(
|
|
18
|
+
MapUtil.of(
|
|
19
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
20
|
+
' THIS IS A NOcoDE plATFORM ',
|
|
21
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
22
|
+
' THIS IS A NOCODE PLATFORM ',
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
expect(
|
|
26
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
27
|
+
).toBeTruthy();
|
|
28
|
+
|
|
29
|
+
fep.setArguments(
|
|
30
|
+
MapUtil.of(
|
|
31
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
32
|
+
' 20934 123 123 245-0 34" 3434 " 123',
|
|
33
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
34
|
+
' w20934 123 123 245-0 34" 3434 " 123 ',
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(
|
|
39
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
40
|
+
).toBe(false);
|
|
41
|
+
|
|
42
|
+
fep.setArguments(
|
|
43
|
+
MapUtil.of(
|
|
44
|
+
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
45
|
+
' no code Kirun PLATform ',
|
|
46
|
+
AbstractStringFunction.PARAMETER_SEARCH_STRING_NAME,
|
|
47
|
+
' NO CODE KIRUN PLATFORM ',
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
fun.execute(fep).allResults()[0].getResult().get(AbstractStringFunction.EVENT_RESULT_NAME),
|
|
53
|
+
).toBe(false);
|
|
54
|
+
});
|