Skip to content

Commit

Permalink
Merge pull request #660 from smeup/bugfix/LS24004854/Coercing-from-un…
Browse files Browse the repository at this point in the history
…limitedString-to-string

Bugfix/LS24004854/Coercing from `UnlimitedString` to `String`
  • Loading branch information
lanarimarco authored Nov 15, 2024
2 parents 9e8b869 + 567f1d1 commit b4e5614
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ fun coerce(value: Value, type: Type): Value {
}
}
is BooleanValue -> coerceBoolean(value, type)
is UnlimitedStringValue -> coerceString(value.value.asValue(), type)
else -> value
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,44 @@ open class MULANGT02ConstAndDSpecTest : MULANGTTest() {
val expected = listOf("*SCPAccesso da script 00S")
assertEquals(expected, "smeup/MUDRNRAPU00154".outputOf(configuration = smeupConfig))
}

/**
* SUBST with a side effect where the factor 2 has changed type in `UnlimitedStringValue`.
* @see #LS24004854
*/
@Test
fun executeMUDRNRAPU00162() {
val expected = listOf("ABCDE", "CDE")
assertEquals(expected, "smeup/MUDRNRAPU00162".outputOf(configuration = smeupConfig))
}

/**
* Assignment of UnlimitedStringValue to a StringValue where the size of first is greater than second.
* @see #LS24004854
*/
@Test
fun executeMUDRNRAPU00163() {
val expected = listOf("ABC")
assertEquals(expected, "smeup/MUDRNRAPU00163".outputOf(configuration = smeupConfig))
}

/**
* Assignment of UnlimitedStringValue to a StringValue where the size of first is smaller than second.
* @see #LS24004854
*/
@Test
fun executeMUDRNRAPU00164() {
val expected = listOf("ABCDE FG")
assertEquals(expected, "smeup/MUDRNRAPU00164".outputOf(configuration = smeupConfig))
}

/**
* Assignment of UnlimitedStringValue to a StringValue (VARYING) where the size of first is smaller than second.
* @see #LS24004854
*/
@Test
fun executeMUDRNRAPU00165() {
val expected = listOf("ABCFG")
assertEquals(expected, "smeup/MUDRNRAPU00165".outputOf(configuration = smeupConfig))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
V* ==============================================================
V* 12/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * SUBST with a side effect where the factor 2 has changed type
O * in `UnlimitedStringValue`.
V* ==============================================================
O * JARIKO ANOMALY
O * Before the fix:
O * `Issue executing SubstStmt at line 22. begin 2, end 10,
O * length 5`
V* ==============================================================
D £UIBDS DS
D £UIBME 10
D £UIBP1 0
D £DECPA S 10
D £G40PA S 10

C EVAL £UIBP1='ABCDE'
C EVAL £DECPA=£UIBP1
C £DECPA DSPLY
C 8 SUBST £DECPA:3 £G40PA #Issue executing SubstStmt at line 22. begin 2, end 10, length 5
C £G40PA DSPLY

C SETON LR
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
V* ==============================================================
V* 12/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * Assignment of UnlimitedStringValue to a StringValue where
O * the size of first is greater than second.
V* ==============================================================
D VARUNL S 0
D VARSTD S 3

C EVAL VARUNL='ABCDE'
C EVAL VARSTD=VARUNL
C VARSTD DSPLY

C SETON LR
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
V* ==============================================================
V* 12/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * Assignment of UnlimitedStringValue to a StringValue where
O * the size of first is smaller than second.
V* ==============================================================
D VARUNL S 0
D VARSTD S 10

C EVAL VARUNL='ABCDE'
C EVAL VARSTD=VARUNL
C MOVE 'FG' VARSTD
C VARSTD DSPLY

C SETON LR
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
V* ==============================================================
V* 12/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * Assignment of UnlimitedStringValue to a StringValue (VARYING)
O * where the size of first is smaller than second.
V* ==============================================================
D VARUNL S 0
D VARSTD S 10 VARYING

C EVAL VARUNL='ABCDE'
C EVAL VARSTD=VARUNL
C MOVE 'FG' VARSTD
C VARSTD DSPLY

C SETON LR

0 comments on commit b4e5614

Please sign in to comment.