@fincity/kirun-js 1.1.1 → 1.1.4
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/__tests__/engine/function/system/array/AddFirstTest.ts +29 -7
- package/__tests__/engine/function/system/array/AddTest.ts +21 -5
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +26 -7
- package/__tests__/engine/function/system/array/CompareTest.ts +5 -1
- package/__tests__/engine/function/system/array/CopyTest.ts +22 -7
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +21 -5
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +17 -4
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +21 -5
- package/__tests__/engine/function/system/array/DeleteTest.ts +29 -9
- package/__tests__/engine/function/system/array/DisjointTest.ts +13 -3
- package/__tests__/engine/function/system/array/Equals.ts +13 -3
- package/__tests__/engine/function/system/array/FillTest.ts +5 -1
- package/__tests__/engine/function/system/array/FrequencyTest.ts +13 -3
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +29 -7
- package/__tests__/engine/function/system/array/IndexOfTest.ts +21 -5
- package/__tests__/engine/function/system/array/InsertTest.ts +25 -6
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +21 -5
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +25 -6
- package/__tests__/engine/function/system/array/MaxTest.ts +33 -24
- package/__tests__/engine/function/system/array/MinTest.ts +33 -24
- package/__tests__/engine/function/system/array/MisMatchTest.ts +17 -4
- package/__tests__/engine/function/system/array/ReverseTest.ts +21 -5
- package/__tests__/engine/function/system/array/RotateTest.ts +13 -3
- package/__tests__/engine/function/system/array/ShuffleTest.ts +9 -2
- package/__tests__/engine/function/system/array/SortTest.ts +21 -5
- package/__tests__/engine/function/system/array/SubArrayTest.ts +21 -5
- package/__tests__/engine/function/system/context/SetFunctionTest.ts +13 -3
- package/__tests__/engine/function/system/math/AddTest.ts +5 -3
- package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +108 -0
- package/__tests__/engine/function/system/math/MaximumTest.ts +38 -0
- package/__tests__/engine/function/system/math/MinimumTest.ts +38 -0
- package/__tests__/engine/function/system/math/RandomFloatTest.ts +83 -0
- package/__tests__/engine/function/system/math/RandomIntTest.ts +19 -11
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +9 -2
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +9 -2
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +13 -3
- package/__tests__/engine/function/system/string/PostPadTest.ts +13 -3
- package/__tests__/engine/function/system/string/PrePadTest.ts +13 -3
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +13 -3
- package/__tests__/engine/function/system/string/ReverseTest.ts +10 -3
- package/__tests__/engine/function/system/string/SplitTest.ts +9 -2
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +13 -3
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +9 -2
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +33 -8
- package/__tests__/engine/function/system/string/ToStringTest.ts +10 -3
- package/__tests__/engine/function/system/string/TrimToTest.ts +9 -2
- package/__tests__/engine/json/schema/SchemaUtil.ts +3 -0
- package/__tests__/engine/json/schema/type/TypeUtilTest.ts +10 -0
- package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +38 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +67 -0
- package/__tests__/engine/runtime/KIRuntimeTest.ts +23 -12
- package/__tests__/engine/runtime/KIRuntimeWithDefinitionTest.ts +88 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +23 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/function/AbstractFunction.ts +14 -5
- package/src/engine/function/system/math/Maximum.ts +1 -1
- package/src/engine/function/system/math/Minimum.ts +1 -1
- package/src/engine/function/system/math/RandomFloat.ts +2 -2
- package/src/engine/function/system/math/RandomInt.ts +1 -1
- package/src/engine/json/schema/Schema.ts +4 -3
- package/src/engine/json/schema/SchemaUtil.ts +4 -4
- package/src/engine/json/schema/type/TypeUtil.ts +3 -5
- package/src/engine/json/schema/validator/SchemaValidator.ts +4 -1
- package/src/engine/model/AbstractStatement.ts +10 -0
- package/src/engine/model/Event.ts +15 -0
- package/src/engine/model/FunctionDefinition.ts +76 -29
- package/src/engine/model/Parameter.ts +11 -0
- package/src/engine/model/ParameterReference.ts +8 -1
- package/src/engine/model/Position.ts +5 -0
- package/src/engine/model/Statement.ts +16 -0
- package/src/engine/model/StatementGroup.ts +7 -0
- package/src/engine/runtime/FunctionExecutionParameters.ts +30 -0
- package/src/engine/runtime/KIRuntime.ts +37 -24
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Minimum } from "../../../../../src/engine/function/system/math/Minimum";
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
|
+
|
|
5
|
+
const min = new Minimum();
|
|
6
|
+
|
|
7
|
+
test('Minimum Test 1', async () => {
|
|
8
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
new KIRunFunctionRepository,
|
|
10
|
+
new KIRunSchemaRepository
|
|
11
|
+
).setArguments(
|
|
12
|
+
new Map([['value', [3, 2, 3, 5, 3]]]),
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('value')).toBe(2);
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('Minimum Test 2', () => {
|
|
19
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
20
|
+
new KIRunFunctionRepository,
|
|
21
|
+
new KIRunSchemaRepository
|
|
22
|
+
).setArguments(
|
|
23
|
+
new Map([['value', ["3", 2, 3, 5, 3]]]),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
expect(async () => (await min.execute(fep)).allResults()[0].getResult().get('value')).rejects.toThrowError("Value \"3\" is not of valid type(s)\n3 is not a Integer\n3 is not a Long\n3 is not a Float\n3 is not a Double");
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('Minimum Test 3', async () => {
|
|
30
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
31
|
+
new KIRunFunctionRepository,
|
|
32
|
+
new KIRunSchemaRepository
|
|
33
|
+
).setArguments(
|
|
34
|
+
new Map([['value', [-1, -2, -3, -5, -3]]]),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('value')).toBe(-5);
|
|
38
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RandomFloat } from "../../../../../src/engine/function/system/math/RandomFloat";
|
|
2
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
|
+
|
|
5
|
+
const rand = new RandomFloat();
|
|
6
|
+
|
|
7
|
+
test('rand Float 1', async () => {
|
|
8
|
+
let min = 1,
|
|
9
|
+
max = 10;
|
|
10
|
+
|
|
11
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
12
|
+
new KIRunFunctionRepository,
|
|
13
|
+
new KIRunSchemaRepository
|
|
14
|
+
).setArguments(
|
|
15
|
+
new Map([
|
|
16
|
+
['minValue', min],
|
|
17
|
+
['maxValue', max],
|
|
18
|
+
]),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
22
|
+
|
|
23
|
+
expect(num).toBeLessThanOrEqual(max);
|
|
24
|
+
expect(num).toBeGreaterThanOrEqual(min);
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('rand Float 2', async () => {
|
|
28
|
+
let min = 0.1,
|
|
29
|
+
max = 0.9;
|
|
30
|
+
|
|
31
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
32
|
+
new KIRunFunctionRepository,
|
|
33
|
+
new KIRunSchemaRepository
|
|
34
|
+
).setArguments(
|
|
35
|
+
new Map([
|
|
36
|
+
['minValue', min],
|
|
37
|
+
['maxValue', max],
|
|
38
|
+
]),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
42
|
+
|
|
43
|
+
expect(num).toBeLessThanOrEqual(max);
|
|
44
|
+
expect(num).toBeGreaterThanOrEqual(min);
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('rand Float 3', async () => {
|
|
48
|
+
let min = 1, max = 2147483647;
|
|
49
|
+
|
|
50
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
51
|
+
new KIRunFunctionRepository,
|
|
52
|
+
new KIRunSchemaRepository
|
|
53
|
+
).setArguments(
|
|
54
|
+
new Map([
|
|
55
|
+
['minValue', min],
|
|
56
|
+
]),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
60
|
+
|
|
61
|
+
expect(num).toBeLessThanOrEqual(max);
|
|
62
|
+
expect(num).toBeGreaterThanOrEqual(min);
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test('rand Float 4', async () => {
|
|
66
|
+
let min = 1.1,
|
|
67
|
+
max = 1.2;
|
|
68
|
+
|
|
69
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
70
|
+
new KIRunFunctionRepository,
|
|
71
|
+
new KIRunSchemaRepository
|
|
72
|
+
).setArguments(
|
|
73
|
+
new Map([
|
|
74
|
+
['minValue', min],
|
|
75
|
+
['maxValue', max],
|
|
76
|
+
]),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
80
|
+
|
|
81
|
+
expect(num).toBeLessThanOrEqual(max);
|
|
82
|
+
expect(num).toBeGreaterThanOrEqual(min);
|
|
83
|
+
})
|
|
@@ -1,44 +1,52 @@
|
|
|
1
1
|
import { RandomInt } from '../../../../../src/engine/function/system/math/RandomInt';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
3
4
|
|
|
4
5
|
const rand = new RandomInt();
|
|
5
6
|
|
|
6
|
-
test(' rand int 1', () => {
|
|
7
|
+
test(' rand int 1', async () => {
|
|
7
8
|
let min = 100,
|
|
8
9
|
max = 1000123;
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
).setArguments(
|
|
10
14
|
new Map([
|
|
11
15
|
['minValue', min],
|
|
12
16
|
['maxValue', max],
|
|
13
17
|
]),
|
|
14
18
|
);
|
|
15
|
-
let num: number = rand.execute(fep).allResults()[0].getResult().get('value');
|
|
19
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
16
20
|
|
|
17
21
|
expect(num).toBeLessThanOrEqual(max);
|
|
18
22
|
expect(num).toBeGreaterThanOrEqual(min);
|
|
19
23
|
});
|
|
20
24
|
|
|
21
|
-
test(' rand int 2', () => {
|
|
25
|
+
test(' rand int 2', async () => {
|
|
22
26
|
let min = 100;
|
|
23
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
24
|
-
new
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
new KIRunFunctionRepository(),
|
|
29
|
+
new KIRunSchemaRepository(),
|
|
30
|
+
).setArguments(new Map([['minValue', min]]));
|
|
31
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
27
32
|
|
|
28
33
|
expect(num).toBeLessThanOrEqual(2147483647);
|
|
29
34
|
expect(num).toBeGreaterThanOrEqual(min);
|
|
30
35
|
});
|
|
31
36
|
|
|
32
|
-
test(' rand int 3', () => {
|
|
37
|
+
test(' rand int 3', async () => {
|
|
33
38
|
let min = 100,
|
|
34
39
|
max = 101;
|
|
35
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
41
|
+
new KIRunFunctionRepository(),
|
|
42
|
+
new KIRunSchemaRepository(),
|
|
43
|
+
).setArguments(
|
|
36
44
|
new Map([
|
|
37
45
|
['minValue', min],
|
|
38
46
|
['maxValue', max],
|
|
39
47
|
]),
|
|
40
48
|
);
|
|
41
|
-
let num: number = rand.execute(fep).allResults()[0].getResult().get('value');
|
|
49
|
+
let num: number = (await rand.execute(fep)).allResults()[0].getResult().get('value');
|
|
42
50
|
|
|
43
51
|
console.log(num);
|
|
44
52
|
expect(num).toBeLessThanOrEqual(max);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { Concatenate } from '../../../../../src/engine/function/system/string/Concatenate';
|
|
2
3
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
4
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
@@ -5,7 +6,10 @@ import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
|
5
6
|
const cat: Concatenate = new Concatenate();
|
|
6
7
|
|
|
7
8
|
test('conatenate test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
let array: string[] = [];
|
|
11
15
|
array.push('I ');
|
|
@@ -37,7 +41,10 @@ test('conatenate test2', async () => {
|
|
|
37
41
|
list.push(' PLATform ');
|
|
38
42
|
list.push('2');
|
|
39
43
|
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
44
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
45
|
+
new KIRunFunctionRepository(),
|
|
46
|
+
new KIRunSchemaRepository(),
|
|
47
|
+
);
|
|
41
48
|
|
|
42
49
|
fep.setArguments(MapUtil.of('value', list));
|
|
43
50
|
expect((await cat.execute(fep)).allResults()[0].getResult().get('value')).toBe(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { DeleteForGivenLength } from '../../../../../src/engine/function/system/string/DeleteForGivenLength';
|
|
2
3
|
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
@@ -6,7 +7,10 @@ import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
|
6
7
|
const deleteT: DeleteForGivenLength = new DeleteForGivenLength();
|
|
7
8
|
|
|
8
9
|
test('DeleteForGivenLength test1', async () => {
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
);
|
|
10
14
|
|
|
11
15
|
fep.setArguments(
|
|
12
16
|
new Map<string, string | number>([
|
|
@@ -24,7 +28,10 @@ test('DeleteForGivenLength test1', async () => {
|
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
test('DeleteForGivenLength test2', async () => {
|
|
27
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
31
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
32
|
+
new KIRunFunctionRepository(),
|
|
33
|
+
new KIRunSchemaRepository(),
|
|
34
|
+
);
|
|
28
35
|
|
|
29
36
|
fep.setArguments(
|
|
30
37
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { InsertAtGivenPosition } from '../../../../../src/engine/function/system/string/InsertAtGivenPosition';
|
|
2
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
2
3
|
|
|
3
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
5
|
|
|
5
6
|
const reve: InsertAtGivenPosition = new InsertAtGivenPosition();
|
|
6
7
|
|
|
7
8
|
test('InsertATGivenPositions test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -21,7 +25,10 @@ test('InsertATGivenPositions test1', async () => {
|
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
test('InsertATGivenPositions test2', async () => {
|
|
24
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
29
|
+
new KIRunFunctionRepository(),
|
|
30
|
+
new KIRunSchemaRepository(),
|
|
31
|
+
);
|
|
25
32
|
|
|
26
33
|
fep.setArguments(
|
|
27
34
|
new Map<string, string | number>([
|
|
@@ -37,7 +44,10 @@ test('InsertATGivenPositions test2', async () => {
|
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
test('InsertATGivenPositions test3', async () => {
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
47
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
48
|
+
new KIRunFunctionRepository(),
|
|
49
|
+
new KIRunSchemaRepository(),
|
|
50
|
+
);
|
|
41
51
|
|
|
42
52
|
fep.setArguments(
|
|
43
53
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { PostPad } from '../../../../../src/engine/function/system/string/PostPad';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const reve: PostPad = new PostPad();
|
|
6
7
|
|
|
7
8
|
test('postpad test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -21,7 +25,10 @@ test('postpad test1', async () => {
|
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
test('postpad test2', async () => {
|
|
24
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
28
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
29
|
+
new KIRunFunctionRepository(),
|
|
30
|
+
new KIRunSchemaRepository(),
|
|
31
|
+
);
|
|
25
32
|
|
|
26
33
|
fep.setArguments(
|
|
27
34
|
new Map<string, string | number>([
|
|
@@ -37,7 +44,10 @@ test('postpad test2', async () => {
|
|
|
37
44
|
});
|
|
38
45
|
|
|
39
46
|
test('postpad test3', async () => {
|
|
40
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
47
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
48
|
+
new KIRunFunctionRepository(),
|
|
49
|
+
new KIRunSchemaRepository(),
|
|
50
|
+
);
|
|
41
51
|
|
|
42
52
|
fep.setArguments(
|
|
43
53
|
new Map<string, string | number>([
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { PrePad } from '../../../../../src/engine/function/system/string/PrePad';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapEntry, MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const prepad: PrePad = new PrePad();
|
|
6
7
|
|
|
7
8
|
test('prepad test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
new Map<string, string | number>([
|
|
@@ -23,7 +27,10 @@ test('prepad test1', async () => {
|
|
|
23
27
|
});
|
|
24
28
|
|
|
25
29
|
test('prepad test2', async () => {
|
|
26
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
30
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
31
|
+
new KIRunFunctionRepository(),
|
|
32
|
+
new KIRunSchemaRepository(),
|
|
33
|
+
);
|
|
27
34
|
|
|
28
35
|
fep.setArguments(
|
|
29
36
|
new Map<string, string | number>([
|
|
@@ -39,7 +46,10 @@ test('prepad test2', async () => {
|
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
test('prepad test3', async () => {
|
|
42
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
49
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
50
|
+
new KIRunFunctionRepository(),
|
|
51
|
+
new KIRunSchemaRepository(),
|
|
52
|
+
);
|
|
43
53
|
|
|
44
54
|
fep.setArguments(
|
|
45
55
|
new Map<string, string | number>([
|
|
@@ -2,10 +2,14 @@ import { RegionMatches } from '../../../../../src/engine/function/system/string/
|
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
4
|
|
|
5
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
5
6
|
const region: RegionMatches = new RegionMatches();
|
|
6
7
|
|
|
7
8
|
test('toString test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
fep.setArguments(
|
|
11
15
|
MapUtil.of<string, string | number | boolean>(
|
|
@@ -33,7 +37,10 @@ test('toString test1', async () => {
|
|
|
33
37
|
});
|
|
34
38
|
|
|
35
39
|
test('toString test2', async () => {
|
|
36
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
40
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
41
|
+
new KIRunFunctionRepository(),
|
|
42
|
+
new KIRunSchemaRepository(),
|
|
43
|
+
);
|
|
37
44
|
fep.setArguments(
|
|
38
45
|
MapUtil.of<string, string | number | boolean>(
|
|
39
46
|
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
@@ -60,7 +67,10 @@ test('toString test2', async () => {
|
|
|
60
67
|
});
|
|
61
68
|
|
|
62
69
|
test('toString test3', async () => {
|
|
63
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
70
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
71
|
+
new KIRunFunctionRepository(),
|
|
72
|
+
new KIRunSchemaRepository(),
|
|
73
|
+
);
|
|
64
74
|
fep.setArguments(
|
|
65
75
|
MapUtil.of<string, string | number | boolean>(
|
|
66
76
|
RegionMatches.PARAMETER_BOOLEAN_NAME,
|
|
@@ -2,11 +2,15 @@ import { Reverse } from '../../../../../src/engine/function/system/string/Revers
|
|
|
2
2
|
import { SchemaValidationException } from '../../../../../src/engine/json/schema/validator/exception/SchemaValidationException';
|
|
3
3
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
4
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
5
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
5
6
|
|
|
6
7
|
const reve: Reverse = new Reverse();
|
|
7
8
|
|
|
8
9
|
test('reverse test1', async () => {
|
|
9
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
11
|
+
new KIRunFunctionRepository(),
|
|
12
|
+
new KIRunSchemaRepository(),
|
|
13
|
+
);
|
|
10
14
|
|
|
11
15
|
fep.setArguments(MapUtil.of('value', ' mr"ofta"lp edoc on a si sihT'));
|
|
12
16
|
|
|
@@ -16,7 +20,10 @@ test('reverse test1', async () => {
|
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
test('reverse test2', async () => {
|
|
19
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
23
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
24
|
+
new KIRunFunctionRepository(),
|
|
25
|
+
new KIRunSchemaRepository(),
|
|
26
|
+
);
|
|
20
27
|
|
|
21
28
|
fep.setArguments(MapUtil.of('value', ' '));
|
|
22
29
|
|
|
@@ -26,7 +33,7 @@ test('reverse test2', async () => {
|
|
|
26
33
|
});
|
|
27
34
|
|
|
28
35
|
// test('reverse test3', async () => {
|
|
29
|
-
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
36
|
+
// let fep: FunctionExecutionParameters = new FunctionExecutionParameters(new KIRunFunctionRepository(), new KIRunSchemaRepository());
|
|
30
37
|
|
|
31
38
|
// fep.setArguments(MapUtil.of('value', null));
|
|
32
39
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Split } from '../../../../../src/engine/function/system/string/Split';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
4
5
|
|
|
5
6
|
const Spli: Split = new Split();
|
|
6
7
|
|
|
7
8
|
test('split test1', async () => {
|
|
8
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
9
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
10
|
+
new KIRunFunctionRepository(),
|
|
11
|
+
new KIRunSchemaRepository(),
|
|
12
|
+
);
|
|
9
13
|
fep.setArguments(
|
|
10
14
|
MapUtil.of(
|
|
11
15
|
'string',
|
|
@@ -35,7 +39,10 @@ test('split test1', async () => {
|
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
test('split test2', async () => {
|
|
38
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
42
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
43
|
+
new KIRunFunctionRepository(),
|
|
44
|
+
new KIRunSchemaRepository(),
|
|
45
|
+
);
|
|
39
46
|
fep.setArguments(
|
|
40
47
|
MapUtil.of(
|
|
41
48
|
'string',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
1
2
|
import { AbstractStringFunction } from '../../../../../src/engine/function/system/string/AbstractStringFunction';
|
|
2
3
|
import { StringFunctionRepository } from '../../../../../src/engine/function/system/string/StringFunctionRepository';
|
|
3
4
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
@@ -8,7 +9,10 @@ const stringRepo = new StringFunctionRepository();
|
|
|
8
9
|
|
|
9
10
|
test('StringRepo - contains', async () => {
|
|
10
11
|
let fun = stringRepo.find(Namespaces.STRING, 'Contains');
|
|
11
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
12
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
13
|
+
new KIRunFunctionRepository(),
|
|
14
|
+
new KIRunSchemaRepository(),
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
if (!fun) {
|
|
14
18
|
throw new Error('Function not available');
|
|
@@ -84,7 +88,10 @@ test('string function repo 2', async () => {
|
|
|
84
88
|
throw new Error('Function not available');
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
91
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
92
|
+
new KIRunFunctionRepository(),
|
|
93
|
+
new KIRunSchemaRepository(),
|
|
94
|
+
);
|
|
88
95
|
fep.setArguments(
|
|
89
96
|
MapUtil.of(
|
|
90
97
|
AbstractStringFunction.PARAMETER_STRING_NAME,
|
|
@@ -140,7 +147,10 @@ test('string function repo 3', async () => {
|
|
|
140
147
|
throw new Error('Function not available');
|
|
141
148
|
}
|
|
142
149
|
|
|
143
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
150
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
151
|
+
new KIRunFunctionRepository(),
|
|
152
|
+
new KIRunSchemaRepository(),
|
|
153
|
+
);
|
|
144
154
|
|
|
145
155
|
fep.setArguments(
|
|
146
156
|
MapUtil.of(
|
|
@@ -3,12 +3,16 @@ import { StringFunctionRepository } from '../../../../../src/engine/function/sys
|
|
|
3
3
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
5
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
6
7
|
|
|
7
8
|
const stringRepo = new StringFunctionRepository();
|
|
8
9
|
|
|
9
10
|
test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
10
11
|
let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
|
|
11
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
12
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
13
|
+
new KIRunFunctionRepository(),
|
|
14
|
+
new KIRunSchemaRepository(),
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
if (!fun) {
|
|
14
18
|
throw new Error('Function not available');
|
|
@@ -48,7 +52,10 @@ test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
|
48
52
|
|
|
49
53
|
test('StringRepo3 - EqualsIgnoreCase', async () => {
|
|
50
54
|
let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
|
|
51
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
55
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
56
|
+
new KIRunFunctionRepository(),
|
|
57
|
+
new KIRunSchemaRepository(),
|
|
58
|
+
).setArguments(
|
|
52
59
|
new Map([
|
|
53
60
|
[AbstractStringFunction.PARAMETER_STRING_NAME, ' no code Kirun PLATform '],
|
|
54
61
|
[
|
|
@@ -3,6 +3,7 @@ import { StringFunctionRepository } from '../../../../../src/engine/function/sys
|
|
|
3
3
|
import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
|
|
4
4
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
5
5
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
6
7
|
|
|
7
8
|
const repo = new StringFunctionRepository();
|
|
8
9
|
|
|
@@ -11,7 +12,10 @@ test('StringFunctionRepository - Trim', async () => {
|
|
|
11
12
|
if (!fun) {
|
|
12
13
|
throw new Error('Function not available');
|
|
13
14
|
}
|
|
14
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
15
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
16
|
+
new KIRunFunctionRepository(),
|
|
17
|
+
new KIRunSchemaRepository(),
|
|
18
|
+
);
|
|
15
19
|
fep.setArguments(MapUtil.of(AbstractStringFunction.PARAMETER_STRING_NAME, ' Kiran '));
|
|
16
20
|
expect(
|
|
17
21
|
(await fun.execute(fep))
|
|
@@ -26,7 +30,10 @@ test('StringFunctionRepo -Repeat', async () => {
|
|
|
26
30
|
if (!fun) {
|
|
27
31
|
throw new Error('Function not available');
|
|
28
32
|
}
|
|
29
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
33
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
34
|
+
new KIRunFunctionRepository(),
|
|
35
|
+
new KIRunSchemaRepository(),
|
|
36
|
+
);
|
|
30
37
|
|
|
31
38
|
fep.setArguments(
|
|
32
39
|
MapUtil.of<string, string | number>(
|
|
@@ -51,7 +58,10 @@ test('StringFunctionRepo -Lowercase', async () => {
|
|
|
51
58
|
throw new Error('Function not available');
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
61
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
62
|
+
new KIRunFunctionRepository(),
|
|
63
|
+
new KIRunSchemaRepository(),
|
|
64
|
+
);
|
|
55
65
|
|
|
56
66
|
fep.setArguments(
|
|
57
67
|
MapUtil.of<string, string | number>(
|
|
@@ -73,7 +83,10 @@ test('StringFunctionRepo -UpperCase', async () => {
|
|
|
73
83
|
if (!fun) {
|
|
74
84
|
throw new Error('Function not available');
|
|
75
85
|
}
|
|
76
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
86
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
87
|
+
new KIRunFunctionRepository(),
|
|
88
|
+
new KIRunSchemaRepository(),
|
|
89
|
+
);
|
|
77
90
|
|
|
78
91
|
fep.setArguments(
|
|
79
92
|
MapUtil.of<string, string | number>(
|
|
@@ -95,7 +108,10 @@ test('StringFunctionRepo -Blank1', async () => {
|
|
|
95
108
|
if (!fun) {
|
|
96
109
|
throw new Error('Function not available');
|
|
97
110
|
}
|
|
98
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
111
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
112
|
+
new KIRunFunctionRepository(),
|
|
113
|
+
new KIRunSchemaRepository(),
|
|
114
|
+
);
|
|
99
115
|
|
|
100
116
|
fep.setArguments(MapUtil.of<string, string>(AbstractStringFunction.PARAMETER_STRING_NAME, ''));
|
|
101
117
|
|
|
@@ -112,7 +128,10 @@ test('StringFunctionRepo -Blank2', async () => {
|
|
|
112
128
|
if (!fun) {
|
|
113
129
|
throw new Error('Function not available');
|
|
114
130
|
}
|
|
115
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
131
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
132
|
+
new KIRunFunctionRepository(),
|
|
133
|
+
new KIRunSchemaRepository(),
|
|
134
|
+
);
|
|
116
135
|
|
|
117
136
|
fep.setArguments(
|
|
118
137
|
MapUtil.of<string, string | number>(
|
|
@@ -134,7 +153,10 @@ test('StringFunctionRepo -Empty1', async () => {
|
|
|
134
153
|
if (!fun) {
|
|
135
154
|
throw new Error('Function not available');
|
|
136
155
|
}
|
|
137
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
156
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
157
|
+
new KIRunFunctionRepository(),
|
|
158
|
+
new KIRunSchemaRepository(),
|
|
159
|
+
);
|
|
138
160
|
|
|
139
161
|
fep.setArguments(
|
|
140
162
|
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ''),
|
|
@@ -153,7 +175,10 @@ test('StringFunctionRepo -Empty2', async () => {
|
|
|
153
175
|
if (!fun) {
|
|
154
176
|
throw new Error('Function not available');
|
|
155
177
|
}
|
|
156
|
-
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
178
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
179
|
+
new KIRunFunctionRepository(),
|
|
180
|
+
new KIRunSchemaRepository(),
|
|
181
|
+
);
|
|
157
182
|
|
|
158
183
|
fep.setArguments(
|
|
159
184
|
MapUtil.of<string, string | number>(AbstractStringFunction.PARAMETER_STRING_NAME, ' '),
|