1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
### OpenCOBOL Test Suite -*- m4 -*-
## Copyright (C) 2003-2009 Keisuke Nishida
## Copyright (C) 2007-2009 Roger While
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this software; see the file COPYING. If not, write to
## the Free Software Foundation, 51 Franklin Street, Fifth Floor
## Boston, MA 02110-1301 USA
### ISO+IEC+1989-2002 14.8.25 MULTIPLY statement
## 14.8.25.2 Syntax rules
# 1) DONE
AT_SETUP([Category check of Format 1])
AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X-X PIC X.
01 X-9 PIC 9.
01 X-09 PIC 09.
PROCEDURE DIVISION.
MULTIPLY 123 BY 456
END-MULTIPLY.
MULTIPLY "a" BY "b"
END-MULTIPLY.
MULTIPLY X-X BY X-9
END-MULTIPLY.
MULTIPLY X-9 BY X-09
END-MULTIPLY.
MULTIPLY X-09 BY X-X
END-MULTIPLY.
STOP RUN.
])
AT_CHECK([${COMPILE_ONLY} prog.cob], [1], ,
[prog.cob:10: Error: '456' is not a numeric name
prog.cob:12: Error: '"a"' is not a numeric value
prog.cob:12: Error: '"b"' is not a numeric name
prog.cob:14: Error: 'X-X' is not a numeric value
prog.cob:16: Error: 'X-09' is not a numeric name
prog.cob:18: Error: 'X-09' is not a numeric value
prog.cob:18: Error: 'X-X' is not a numeric name
])
AT_CLEANUP
# 2) DONE
AT_SETUP([Category check of Format 2])
AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X-X PIC X.
01 X-9 PIC 9.
01 X-09 PIC 09.
PROCEDURE DIVISION.
MULTIPLY 123 BY 456 GIVING 789
END-MULTIPLY.
MULTIPLY "a" BY "b" GIVING "c"
END-MULTIPLY.
MULTIPLY X-X BY X-9 GIVING X-09
END-MULTIPLY.
MULTIPLY X-9 BY X-09 GIVING X-X
END-MULTIPLY.
MULTIPLY X-09 BY X-X GIVING X-9
END-MULTIPLY.
STOP RUN.
])
AT_CHECK([${COMPILE_ONLY} prog.cob], [1], ,
[prog.cob:10: Error: '789' is not numeric or numeric-edited name
prog.cob:12: Error: '"a"' is not a numeric value
prog.cob:12: Error: '"b"' is not a numeric value
prog.cob:12: Error: '"c"' is not numeric or numeric-edited name
prog.cob:14: Error: 'X-X' is not a numeric value
prog.cob:16: Error: 'X-09' is not a numeric value
prog.cob:16: Error: 'X-X' is not numeric or numeric-edited name
prog.cob:18: Error: 'X-09' is not a numeric value
prog.cob:18: Error: 'X-X' is not a numeric value
])
AT_CLEANUP
# 3) DONE
AT_SETUP([Category check of literals])
AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC 9.
PROCEDURE DIVISION.
MULTIPLY 123 BY X
END-MULTIPLY.
MULTIPLY "a" BY X
END-MULTIPLY.
MULTIPLY 123 BY 456 GIVING X
END-MULTIPLY.
MULTIPLY "a" BY "b" GIVING X
END-MULTIPLY.
STOP RUN.
])
AT_CHECK([${COMPILE_ONLY} prog.cob], [1], ,
[prog.cob:10: Error: '"a"' is not a numeric value
prog.cob:14: Error: '"a"' is not a numeric value
prog.cob:14: Error: '"b"' is not a numeric value
])
AT_CLEANUP
# 4) TODO
|