Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 125 additions & 125 deletions src/test/java/eu/europa/ted/efx/sdk2/EfxExpressionTranslatorV2Test.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ void testDisplayTemplate_WithTextSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let text*:$items = ('a', 'b', 'c');",
"let text*:$items = ['a', 'b', 'c'];",
"display count: ${count($items)};")));
}

Expand All @@ -530,7 +530,7 @@ void testDisplayTemplate_WithNumericSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let number*:$nums = (1, 2, 3);",
"let number*:$nums = [1, 2, 3];",
"display count: ${count($nums)};")));
}

Expand All @@ -545,7 +545,7 @@ void testDisplayTemplate_WithBooleanSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let indicator*:$flags = (TRUE, FALSE);",
"let indicator*:$flags = [TRUE, FALSE];",
"display count: ${count($flags)};")));
}

Expand All @@ -560,7 +560,7 @@ void testDisplayTemplate_WithDateSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let date*:$dates = (2024-01-01Z, 2024-12-31Z);",
"let date*:$dates = [2024-01-01Z, 2024-12-31Z];",
"display count: ${count($dates)};")));
}

Expand All @@ -575,7 +575,7 @@ void testDisplayTemplate_WithTimeSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let time*:$times = (10:00:00Z, 18:00:00Z);",
"let time*:$times = [10:00:00Z, 18:00:00Z];",
"display count: ${count($times)};")));
}

Expand All @@ -590,7 +590,7 @@ void testDisplayTemplate_WithDurationSequenceVariable() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let measure*:$durs = (P1Y, P2M);",
"let measure*:$durs = [P1Y, P2M];",
"display count: ${count($durs)};")));
}

Expand All @@ -609,7 +609,7 @@ void testDisplayTemplate_WithTextSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let text*:?getItems() = ('a', 'b', 'c');",
"let text*:?getItems() = ['a', 'b', 'c'];",
"display count: ${count(?getItems())};")));
}

Expand All @@ -624,7 +624,7 @@ void testDisplayTemplate_WithNumericSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let number*:?getNumbers() = (1, 2, 3);",
"let number*:?getNumbers() = [1, 2, 3];",
"display count: ${count(?getNumbers())};")));
}

Expand All @@ -639,7 +639,7 @@ void testDisplayTemplate_WithBooleanSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let indicator*:?getFlags() = (TRUE, FALSE);",
"let indicator*:?getFlags() = [TRUE, FALSE];",
"display count: ${count(?getFlags())};")));
}

Expand All @@ -654,7 +654,7 @@ void testDisplayTemplate_WithDateSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let date*:?getDates() = (2024-01-01Z, 2024-12-31Z);",
"let date*:?getDates() = [2024-01-01Z, 2024-12-31Z];",
"display count: ${count(?getDates())};")));
}

Expand All @@ -669,7 +669,7 @@ void testDisplayTemplate_WithTimeSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let time*:?getTimes() = (10:00:00Z, 18:00:00Z);",
"let time*:?getTimes() = [10:00:00Z, 18:00:00Z];",
"display count: ${count(?getTimes())};")));
}

Expand All @@ -684,7 +684,7 @@ void testDisplayTemplate_WithDurationSequenceFunction() {
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate(lines(
"let measure*:?getDurations() = (P1Y, P2M);",
"let measure*:?getDurations() = [P1Y, P2M];",
"display count: ${count(?getDurations())};")));
}

Expand Down Expand Up @@ -1169,7 +1169,7 @@ void testLabelBlock_ComputedLabelReference() {
"let body01() -> { label(string-join(('field','|','name','|','BT-00-Text'), ', ')) }",
"MAIN:",
"for-each(/*/PathNode/TextField).call(body01())"),
translateTemplate("{BT-00-Text} #{${string-join(('field', '|', 'name', '|', 'BT-00-Text'), ', ')}}"));
translateTemplate("{BT-00-Text} #{${string-join(['field', '|', 'name', '|', 'BT-00-Text'], ', ')}}"));
}

@Test
Expand Down Expand Up @@ -1906,7 +1906,7 @@ void testExpressionBlock_LiteralNumericSequence() {
"let body01() -> { text('Values: ')eval((1,2,3)) }",
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate("{ND-Root} Values: ${(1,2,3)}"));
translateTemplate("{ND-Root} Values: ${[1,2,3]}"));
}

@Test
Expand All @@ -1917,7 +1917,7 @@ void testExpressionBlock_MixedSequenceWithField() {
"let body01() -> { text('Values: ')eval((1,2,PathNode/NumberField/number())) }",
"MAIN:",
"for-each(/*).call(body01())"),
translateTemplate("{ND-Root} Values: ${(1,2,BT-00-Number)}"));
translateTemplate("{ND-Root} Values: ${[1,2,BT-00-Number]}"));
}

// #endregion Repeatable Fields in Expression Blocks -------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ FOR BT-00-Indicator IN *;

// Rule with code check
WITH ND-Root
ASSERT BT-00-Code in ("code1", "code2", "code3")
ASSERT BT-00-Code in ["code1", "code2", "code3"]
AS ERROR R-S9L-R5K
FOR BT-00-Code IN *;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET indicator* : $flags = (TRUE, FALSE, TRUE);
LET indicator* : $flags = [TRUE, FALSE, TRUE];

---- STAGE 1a ----

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET date* : $dates = (2024-01-01Z, 2024-06-01Z);
LET date* : $dates = [2024-01-01Z, 2024-06-01Z];

---- STAGE 1a ----

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET measure* : $durations = (P1D, P2D);
LET measure* : $durations = [P1D, P2D];

---- STAGE 1a ----

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET number* : $numbers = (1, 2, 3);
LET number* : $numbers = [1, 2, 3];

---- STAGE 1a ----

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET text* : $languages = ('EN', 'FR', 'DE');
LET text* : $languages = ['EN', 'FR', 'DE'];

---- STAGE 1a ----

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LET time* : $times = (09:00:00Z, 17:00:00Z);
LET time* : $times = [09:00:00Z, 17:00:00Z];

---- STAGE 1a ----

Expand Down
55 changes: 55 additions & 0 deletions src/test/resources/json/sdk2-fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,61 @@
"value": true
}
},
{
"id": "BT-00-Repeatable-Number",
"alias": "repeatableNumberField",
"type": "number",
"parentNodeId": "ND-Root",
"xpathAbsolute": "/*/PathNode/RepeatableNumberField",
"xpathRelative": "PathNode/RepeatableNumberField",
"repeatable": {
"value": true
}
},
{
"id": "BT-00-Repeatable-Indicator",
"alias": "repeatableIndicatorField",
"type": "indicator",
"parentNodeId": "ND-Root",
"xpathAbsolute": "/*/PathNode/RepeatableIndicatorField",
"xpathRelative": "PathNode/RepeatableIndicatorField",
"repeatable": {
"value": true
}
},
{
"id": "BT-00-Repeatable-Date",
"alias": "repeatableDateField",
"type": "date",
"parentNodeId": "ND-Root",
"xpathAbsolute": "/*/PathNode/RepeatableDateField",
"xpathRelative": "PathNode/RepeatableDateField",
"repeatable": {
"value": true
}
},
{
"id": "BT-00-Repeatable-Time",
"alias": "repeatableTimeField",
"type": "time",
"parentNodeId": "ND-Root",
"xpathAbsolute": "/*/PathNode/RepeatableTimeField",
"xpathRelative": "PathNode/RepeatableTimeField",
"repeatable": {
"value": true
}
},
{
"id": "BT-00-Repeatable-Duration",
"alias": "repeatableDurationField",
"type": "duration",
"parentNodeId": "ND-Root",
"xpathAbsolute": "/*/PathNode/RepeatableDurationField",
"xpathRelative": "PathNode/RepeatableDurationField",
"repeatable": {
"value": true
}
},
{
"id": "BT-00-Text-In-Repeatable-Node",
"alias": "textInRepeatableNode",
Expand Down