Skip to content

Commit

Permalink
testcase for [r4670] which fixed decimal constants changing their pre…
Browse files Browse the repository at this point in the history
…cision [bugs:#798]
  • Loading branch information
sf-mensch committed Dec 14, 2022
1 parent f48e4fb commit f23cbe2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/testsuite.src/run_fundamental.at
Original file line number Diff line number Diff line change
Expand Up @@ -5070,6 +5070,42 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], [])
AT_CLEANUP


AT_SETUP([COMPUTE with decimal constants])
AT_KEYWORDS([fundamental])

# see bug #798, GC 2.2 may change the precision of decimal contants

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CNT PIC 99 VALUE ZERO.
77 CALCER PIC s99v99.
01 DUMMY-RES PIC 99.
*>
PROCEDURE DIVISION.
*> variable setting postponed here to work around "easy"
*> optimization to constant
MOVE 3.5 TO CALCER
PERFORM 42 TIMES
ADD 1 TO CNT
>>D DISPLAY CNT
*> directly returns:
*> COMPUTE DUMMY-RES = 2 * (CALCER + 2) + 2
*> performs "felt as forever":
COMPUTE DUMMY-RES = (CALCER + 2) * 2 + 2
END-PERFORM

GOBACK.
])

AT_CHECK([$COMPILE prog.cob])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], [])

AT_CLEANUP


AT_SETUP([debugging lines (not active)])
AT_KEYWORDS([fundamental])

Expand Down

0 comments on commit f23cbe2

Please sign in to comment.