Skip to content

Commit

Permalink
Merge pull request #439 from smeup/bugfix/NW23001440/enums-ka-ky
Browse files Browse the repository at this point in the history
Bugfix/nw23001440/enums ka ky
  • Loading branch information
cosentino-smeup authored Mar 5, 2024
2 parents 745baf8 + fceda42 commit 96d6058
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ enum class IndicatorType(val range: IntRange) {
OC(102..102),
OF(103..103),
OV(104..104),
KA(105..105),
KB(106..106),
KC(107..107),
KD(108..108),
KE(109..109),
KF(110..110),
KG(111..111),
KH(112..112),
KI(113..113),
KJ(114..114),
KK(115..115),
KL(116..116),
KM(117..117),
KN(118..118),
KP(119..119),
KQ(120..120),
KR(121..121),
KS(122..122),
KT(123..123),
KU(124..124),
KV(125..125),
KW(126..126),
KX(127..127),
KY(128..128),
;

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,8 @@ private fun annidatedReferenceExpression(
}
}
if (text.uppercase(Locale.getDefault()).startsWith("*IN")) {
val index = text.uppercase(Locale.getDefault()).removePrefix("*IN").toInt()
return IndicatorExpr(index, position)
val index = text.uppercase(Locale.getDefault()).removePrefix("*IN")
return IndicatorExpr(index.toIndicatorKey(), position)
}

var expr: Expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,15 @@ Test 6
assertEquals(expected, "INDIC02".outputOf())
}

@Test
fun executeINDIC03() {
val expected = listOf(
"*INKA(0) *IN01(1)",
"*INKA(1) *IN01(0)"
)
assertEquals(expected, "INDIC03".outputOf())
}

@Test
fun executeBIFCHECK() {
assertEquals(listOf("ok"), outputOf("BIFCHECK"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,10 @@ open class SmeupInterpreterTest : AbstractTest() {
)
assertEquals(expected, "smeup/T02_A50_P09".outputOf())
}

@Test
fun executeT60_A10_P01() {
val expected = listOf<String>("KA(0)KB(0)KC(0)KD(0)KE(0)KF(0)KG(0)KH(0)KI(0)KJ(0)KK(0)KL(0)KM(0)KN(0)KP(0)KQ(0)KR(0)KS(0)KT(0)KU(0)KV(0)KW(0)KX(0)KY(0)")
assertEquals(expected, "smeup/T60_A10_P01".outputOf(configuration = smeupConfig))
}
}
18 changes: 18 additions & 0 deletions rpgJavaInterpreter-core/src/test/resources/INDIC03.rpgle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
D £DBG_Str S 50 VARYING

C MOVEL *ON *IN01
C MOVEL *OFF *INKA
*
C EVAL £DBG_Str= '*INKA('+%CHAR(*INKA)+')'
C +' *IN01('+%CHAR(*IN01)+')'
C £DBG_Str DSPLY
* result: '*INKA(0) *IN01(1)'
*
C MOVEL *OFF *IN01
C MOVEL *ON *INKA
*
C EVAL £DBG_Str= '*INKA('+%CHAR(*INKA)+')'
C +' *IN01('+%CHAR(*IN01)+')'
C £DBG_Str DSPLY
* result: '*INKA(1) *IN01(0)'
C SETON LR
108 changes: 108 additions & 0 deletions rpgJavaInterpreter-core/src/test/resources/smeup/T60_A10_P01.rpgle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
D £DBG_Str S 250
D $OP S 1N INZ(*ON)

D* Test sugli indicatori delle chiavi KA-KY (F01-F24)
C EVAL £DBG_Str=''
C IF $OP=*OFF
C OPEN MLNGT60V
C ENDIF
C KA EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KA(1) '
C NKA EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KA(0) '
C KB EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KB(1) '
C NKB EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KB(0) '
C KC EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KC(1) '
C NKC EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KC(0) '
C KD EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KD(1) '
C NKD EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KD(0) '
C KE EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KE(1) '
C NKE EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KE(0) '
C KF EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KF(1) '
C NKF EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KF(0) '
C KG EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KG(1) '
C NKG EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KG(0) '
C KH EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KH(1) '
C NKH EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KH(0) '
C KI EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KI(1) '
C NKI EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KI(0) '
C KJ EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KJ(1) '
C NKJ EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KJ(0) '
C KK EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KK(1) '
C NKK EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KK(0) '
C KL EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KL(1) '
C NKL EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KL(0) '
C KM EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KM(1) '
C NKM EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KM(0) '
C KN EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KN(1) '
C NKN EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KN(0) '
C KP EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KP(1) '
C NKP EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KP(0) '
C KQ EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KQ(1) '
C NKQ EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KQ(0) '
C KR EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KR(1) '
C NKR EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KR(0) '
C KS EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KS(1) '
C NKS EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KS(0) '
C KT EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KT(1) '
C NKT EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KT(0) '
C KU EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KU(1) '
C NKU EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KU(0) '
C KV EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KV(1) '
C NKV EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KV(0) '
C KW EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KW(1) '
C NKW EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KW(0) '
C KX EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KX(1) '
C NKX EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KX(0) '
C KY EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KY(1)'
C NKY EVAL £DBG_Str=%TRIM(£DBG_Str)+
C 'KY(0)'
C IF $OP=*OFF
C CLOSE MLNGT60V
C ENDIF
C £DBG_Str DSPLY
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{"name": "MLNGT60V",
"tableName": "MULANGTF",
"recordFormat": "",
"fields": [
{ "fieldName": "*IN62",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}}
, { "fieldName": "*IN96",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}}
, { "fieldName": "*IN97",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}}
, { "fieldName": "£RASDI",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":15, "varying":false}}
, { "fieldName": "£PDSNP",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}}
, { "fieldName": "£PDSJN",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}}
, { "fieldName": "£PDSNU",
"type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}}
], "accessFields": []}

0 comments on commit 96d6058

Please sign in to comment.