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
10 changes: 0 additions & 10 deletions .claude/settings.local.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class RpgParserFacade {
val code = inputStreamToString(inputStream)
val lines = code.lines()
val longLines = lines.map { it.padEnd(threshold) }
val paddedCode = longLines.joinToString(System.lineSeparator())
val paddedCode = longLines.joinToString("\n")
return CharStreams.fromStream(paddedCode.byteInputStream(StandardCharsets.UTF_8))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ fun String?.asDouble(): Double {

fun String.asBigDecimal(): BigDecimal? =
try {
BigDecimal(this.trim())
BigDecimal(this.trim().replace(',', '.'))
} catch (e: Exception) {
null
error("Unable to parse $this as BigDecimal")
}

fun Int.ceilDiv(divisor: Int): Int = this / divisor + if (this % divisor > 0) 1 else 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,11 @@ Test 6
)
}

@Test
fun executeBIFDEC01() {
assertEquals(listOf("1.30", "1.30"), outputOf("BIFDEC01"))
}

@Test
fun executeBIFEDITC() {
// I don't know exactly what expected result should be
Expand Down Expand Up @@ -1306,7 +1311,7 @@ Test 6
}

@Test
fun EVALwithTypeError() {
fun evalWithTypeError() {
val systemInterface = JavaSystemInterface()

val source =
Expand Down
25 changes: 25 additions & 0 deletions rpgJavaInterpreter-core/src/test/resources/BIFDEC01.rpgle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
V* ==============================================================
D* Purpose of this program is to fix %DEC when the string
D* contains italian decimal separator (comma instead of dot)
V* ==============================================================

D DECIMAL S 9 2
D STR S 10A

* %DEC with dot decimal separator ************************************
C EVAL STR='1.30'
C EVAL DECIMAL=%DEC(STR:9:2)
* Expected:
* DECIMAL = 1.30
C DECIMAL DSPLY
***********************************************************************

* %DEC with italian decimal separator (comma) ************************
C EVAL STR='1,30'
C EVAL DECIMAL=%DEC(STR:9:2)
* Expected:
* DECIMAL = 1.30
C DECIMAL DSPLY
***********************************************************************

C SETON LR
Loading