Skip to content

Commit

Permalink
Edit test + fall-through comment
Browse files Browse the repository at this point in the history
  • Loading branch information
emilienlemaire committed Dec 19, 2024
1 parent d764aa7 commit f9b5d9c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 deletions.
1 change: 1 addition & 0 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,6 +2524,7 @@ setup_parameters (struct cb_field *f)
&& f->pic->orig[0] == 'X') {
f->usage = CB_USAGE_COMP_X;
}
/* Fall-through */
case CB_USAGE_COMP_X:
if (f->pic->category == CB_CATEGORY_ALPHANUMERIC
&& f->usage == CB_USAGE_COMP_X) {
Expand Down
42 changes: 21 additions & 21 deletions tests/testsuite.src/run_file.at
Original file line number Diff line number Diff line change
Expand Up @@ -10937,7 +10937,7 @@ AT_DATA([prog.cob], [
MOVE 5 TO FCD-MAX-REC-LENGTH.
CALL "EXTFH" USING OPCODE, FCD.
DISPLAY "OPEN STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY.
FCD-FILE-STATUS.

* READ RECORD
MOVE OP-READ-NEXT TO OPCODE.
Expand All @@ -10946,15 +10946,15 @@ AT_DATA([prog.cob], [
MOVE SPACE TO EX-RECORD-BUFFER
CALL "EXTFH" USING OPCODE, FCD
DISPLAY "READ NEXT STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY
FCD-FILE-STATUS
DISPLAY "DATA:" EX-RECORD-BUFFER(1:10) '-'
END-PERFORM.

* CLOSE FILE
MOVE OP-CLOSE TO OPCODE.
CALL "EXTFH" USING OPCODE, FCD.
DISPLAY "CLOSE STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY.
FCD-FILE-STATUS.

* OPEN second file
MOVE fcd--line-sequential-org TO FCD-ORGANIZATION.
Expand All @@ -10966,7 +10966,7 @@ AT_DATA([prog.cob], [
MOVE 10 TO FCD-MAX-REC-LENGTH.
CALL "EXTFH" USING OPCODE, FCD.
DISPLAY "OPEN STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY.
FCD-FILE-STATUS.

* READ RECORD
MOVE OP-READ-NEXT TO OPCODE.
Expand All @@ -10975,15 +10975,15 @@ AT_DATA([prog.cob], [
MOVE SPACE TO EX-RECORD-BUFFER
CALL "EXTFH" USING OPCODE, FCD
DISPLAY "READ NEXT STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY
FCD-FILE-STATUS
DISPLAY "DATA:" EX-RECORD-BUFFER(1:10) '-'
END-PERFORM.

* CLOSE FILE
MOVE OP-CLOSE TO OPCODE.
CALL "EXTFH" USING OPCODE, FCD.
DISPLAY "CLOSE STATUS:"
FCD-STATUS-KEY-1 "/" FCD-BINARY.
FCD-FILE-STATUS.

MAIN-EXT.
STOP RUN.
Expand All @@ -10992,32 +10992,32 @@ AT_DATA([prog.cob], [
AT_CHECK([$COMPILE prog.cob], [0], [], [])

AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
[OPEN STATUS:0/048
READ NEXT STATUS:0/048
[OPEN STATUS:00
READ NEXT STATUS:00
DATA:SEQ01 -
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:SEQ02 -
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:SEQ03 -
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:SEQ04 -
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:SEQ05 -
READ NEXT STATUS:1/048
READ NEXT STATUS:10
DATA: -
CLOSE STATUS:0/048
OPEN STATUS:0/048
READ NEXT STATUS:0/048
CLOSE STATUS:00
OPEN STATUS:00
READ NEXT STATUS:00
DATA:TXTA123456-
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:TXTB123456-
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:TXTC123456-
READ NEXT STATUS:0/048
READ NEXT STATUS:00
DATA:TXTD123456-
READ NEXT STATUS:1/048
READ NEXT STATUS:10
DATA: -
CLOSE STATUS:0/048
CLOSE STATUS:00
], [])

AT_CLEANUP
Expand Down
14 changes: 12 additions & 2 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -15134,8 +15134,8 @@ AT_CHECK([COB_PROF_ENABLE=1 COB_PROF_FILE=prof.csv $COBCRUN_DIRECT ./caller], [0
AT_CLEANUP


AT_SETUP([display COMP-X of one byte])
AT_KEYWORDS([display comp-x])
AT_SETUP([display all characters of COMP-X])
#AT_KEYWORDS([display comp-x])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand All @@ -15148,25 +15148,35 @@ AT_DATA([prog.cob], [
01 W-Y PIC X COMP-X VALUE 128.
01 W-Z PIC X VALUE "z".
01 W-ZR REDEFINES W-Z PIC X COMP-X.
01 W-A PIC XX COMP-X VALUE 256.
01 W-B PIC XX COMP-X VALUE 64046.

PROCEDURE DIVISION.
MAIN.
DISPLAY FUNCTION BYTE-LENGTH (W-X).
DISPLAY FUNCTION BYTE-LENGTH (W-Y).
DISPLAY FUNCTION BYTE-LENGTH (W-ZR).
DISPLAY FUNCTION BYTE-LENGTH (W-A).
DISPLAY FUNCTION BYTE-LENGTH (W-B).
DISPLAY W-X.
DISPLAY W-Y.
DISPLAY W-ZR.
DISPLAY W-A.
DISPLAY W-B.
STOP RUN.
])

AT_CHECK([$COMPILE prog.cob])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [1
1
1
2
2
099
128
122
00256
64046
], [])

AT_CLEANUP

0 comments on commit f9b5d9c

Please sign in to comment.