Skip to content

Commit

Permalink
Merge pull request #661 from smeup/bugfix/LS24004909/MOVEA-bool-to-array
Browse files Browse the repository at this point in the history
Bugfix/LS24004909/MOVEA Bool to Array
  • Loading branch information
lanarimarco authored Nov 21, 2024
2 parents b4e5614 + 4f34edb commit be46e1b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ private fun coerceBoolean(value: BooleanValue, type: Type): Value {
is BooleanType -> value
is StringType -> value.asString()
is UnlimitedStringType -> value.asUnlimitedString()
is ArrayType -> {
val coercedValue = coerce(value, type.element)
ConcreteArrayValue(MutableList(type.nElements) { coercedValue }, type.element)
}
else -> TODO("Converting BooleanValue to $type")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,4 +624,24 @@ open class MULANGT10BaseCodopTest : MULANGTTest() {
val expected = listOf("", "0")
assertEquals(expected, "smeup/MUDRNRAPU00161".outputOf(configuration = smeupConfig))
}

/**
* Assignment of a boolean value (*OFF) to an array by using MOVEA.
* @see #LS24004909
*/
@Test
fun executeMUDRNRAPU00166() {
val expected = listOf("1", "1", "1", "0", "0", "0")
assertEquals(expected, "smeup/MUDRNRAPU00166".outputOf(configuration = smeupConfig))
}

/**
* Assignment of a boolean value (*ON) to an array by using MOVEA.
* @see #LS24004909
*/
@Test
fun executeMUDRNRAPU00167() {
val expected = listOf("0", "0", "0", "1", "1", "1")
assertEquals(expected, "smeup/MUDRNRAPU00167".outputOf(configuration = smeupConfig))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
V* ==============================================================
V* 13/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * Assignment of a boolean value to an array by using MOVEA.
V* ==============================================================
O * JARIKO ANOMALY
O * Before the fix:
O * `An operation is not implemented: Converting BooleanValue
O * to ArrayType`
V* ==============================================================
D ARR S 1 DIM(3) INZ(*ON)
D I S 1 0
D MSG S 1

C EXSR SHOW_RES
C MOVEA *OFF ARR #An operation is not implemented: Converting BooleanValue to ArrayType
C EXSR SHOW_RES

C SETON LR

C SHOW_RES BEGSR
C FOR I=1 TO %ELEM(ARR)
C EVAL MSG=%CHAR(ARR(I))
C MSG DSPLY
C ENDFOR
C ENDSR
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
V* ==============================================================
V* 13/11/2024 APU001 Creation
V* ==============================================================
O * PROGRAM GOAL
O * Assignment of a boolean value to an array by using MOVEA.
V* ==============================================================
O * JARIKO ANOMALY
O * Before the fix:
O * `An operation is not implemented: Converting BooleanValue
O * to ArrayType`
V* ==============================================================
D ARR S 1 DIM(3) INZ(*OFF)
D I S 1 0
D MSG S 1

C EXSR SHOW_RES
C MOVEA *ON ARR #An operation is not implemented: Converting BooleanValue to ArrayType
C EXSR SHOW_RES

C SETON LR

C SHOW_RES BEGSR
C FOR I=1 TO %ELEM(ARR)
C EVAL MSG=%CHAR(ARR(I))
C MSG DSPLY
C ENDFOR
C ENDSR

0 comments on commit be46e1b

Please sign in to comment.