Skip to content

Commit

Permalink
Fix bug 1008
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Nov 24, 2024
1 parent 04916dd commit 3d60f6d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 4 deletions.
4 changes: 4 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2024-11-22 Chuck Haatvedt <[email protected]>

* move.c (optimized_move_display_to_edited): fixed Bug #1008

2024-10-22 Chuck Haatvedt <[email protected]>

* screenio.c (cob_screen_get_all): fixed Bug #999
Expand Down
14 changes: 13 additions & 1 deletion libcob/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,16 @@ optimized_move_display_to_edited (cob_field *f1, cob_field *f2)

case '0':
case '/':
*dst = c;
if (suppress_zero && prev_float_char) {
*dst = *prev_float_char;
*prev_float_char = pad;
prev_float_char = dst;
if (*dst != currency) {
sign_position = dst;
}
} else {
*dst = c;
}
dst++;
break;

Expand All @@ -1211,6 +1220,9 @@ optimized_move_display_to_edited (cob_field *f1, cob_field *f2)
*dst = *prev_float_char;
*prev_float_char = pad;
prev_float_char = dst;
if (*dst != currency) {
sign_position = dst;
}
} else if (have_check_protect) {
*dst = pad;
} else {
Expand Down
61 changes: 58 additions & 3 deletions tests/testsuite.src/run_fundamental.at
Original file line number Diff line number Diff line change
Expand Up @@ -1980,13 +1980,13 @@ AT_DATA([prog.cob], [

MOVE 10 TO identifier-1
MOVE identifier-1 TO EX-13
IF EX-13 EQUAL " $//00//10 "
IF EX-13 EQUAL " $00//10 "
MOVE "PASS" TO MSG-1
D DISPLAY " $//00//10 IS WHAT I EXPECTED"
D DISPLAY " $00//10 IS WHAT I EXPECTED"
ELSE
ADD 1 TO WS-COUNT
MOVE "FAIL" TO MSG-1
DISPLAY "EX-13.02 EXPECTING ==>' $//00//10 ' "
DISPLAY "EX-13.02 EXPECTING ==>' $00//10 ' "
"WHAT I GOT WAS ==>'"
EX-13 "'<=="
D DISPLAY "------------------" MSG-1
Expand Down Expand Up @@ -2510,6 +2510,61 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
AT_CLEANUP


AT_SETUP([MOVE to item with signs and blanks])
AT_KEYWORDS([fundamental edited editing])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 W-P4 PIC S9 VALUE +4.
01 W-M4 PIC S9 VALUE -4.
01 W-M PIC -B- VALUE SPACES.
01 W-P PIC +B+ VALUE SPACES.

01 W-P123 PIC S9(3) VALUE +123.
01 W-M123 PIC S9(3) VALUE -123.
01 W-MM PIC ---B--9 VALUE SPACES.
01 W-PP PIC +++B++9 VALUE SPACES.

PROCEDURE DIVISION.
MOVE W-P4 TO W-M.
DISPLAY W-M.
MOVE W-M4 TO W-M.
DISPLAY W-M.
MOVE W-P4 TO W-P.
DISPLAY W-P.
MOVE W-M4 TO W-P.
DISPLAY W-P.

MOVE W-P123 TO W-MM.
DISPLAY W-MM.
MOVE W-M123 TO W-MM.
DISPLAY W-MM.
MOVE W-P123 TO W-PP.
DISPLAY W-PP.
MOVE W-M123 TO W-PP.
DISPLAY W-PP.
STOP RUN.
])

AT_CHECK([$COMPILE prog.cob], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
[ 4
-4
+4
-4
123
-123
+123
-123
])

AT_CLEANUP


AT_SETUP([MOVE to JUSTIFIED item])
AT_KEYWORDS([fundamental])

Expand Down

0 comments on commit 3d60f6d

Please sign in to comment.