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 6fd9fab
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Install packages
run: |
brew install pkg-config automake libtool help2man texinfo bison berkeley-db@4 json-c
brew install automake libtool help2man texinfo bison berkeley-db@4 json-c
opt="/opt/homebrew/opt"
echo "$opt/pkg-config/bin" >> $GITHUB_PATH
echo "LDFLAGS=-L$opt/berkeley-db@4/lib ${LDFLAGS}" >> $GITHUB_ENV
Expand Down
6 changes: 6 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

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

* move.c (optimized_move_display_to_edited): fixed
Bug #1008: regression in move to numeric edited
items with insertion symbols B, 0 and /

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
78 changes: 75 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,78 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
AT_CLEANUP


AT_SETUP([MOVE to item with +, -, B, 0, / and ,])
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.

01 W-X PIC -//00BB,,- 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.

MOVE W-P4 TO W-X.
DISPLAY W-X.
MOVE W-M4 TO W-X.
DISPLAY W-X.

MOVE W-P123 TO W-X.
DISPLAY W-X.
MOVE W-M123 TO W-X.
DISPLAY W-X.

STOP RUN.
])

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

AT_CLEANUP


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

Expand Down

0 comments on commit 6fd9fab

Please sign in to comment.