Skip to content

Commit

Permalink
Merge pull request #311 from ashiskumarnaik/test-suites
Browse files Browse the repository at this point in the history
lab for setting the COBOL Check environment
  • Loading branch information
MikeBauerCA authored Dec 4, 2023
2 parents f780701 + 4148f2b commit 91efa44
Show file tree
Hide file tree
Showing 41 changed files with 743 additions and 94 deletions.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/cbl/DEPTPAY.CBL
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. DEPTPAY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DEPT-RECORD.
05 DEPT-NAME PIC X(20).
05 DEPT-LOC PIC X(12).
05 DEPT-MANAGER.
10 MANAGER-FNAME PIC X(15).
10 MANAGER-LNAME PIC X(15).
05 DEPT-NBR-EMPS PIC 9(3).
05 DEPT-TOTAL-SALARIES PIC 9(7)V99.
05 DEPT-AVG-SALARY PIC 9(7)V99.
PROCEDURE DIVISION.
PERFORM AVERAGE-SALARY.
PERFORM DISPLAY-DETAILS.
STOP RUN.

AVERAGE-SALARY.
MOVE "FINANCE" TO DEPT-NAME.
MOVE "SOUTHWEST" TO DEPT-LOC.
MOVE "Millard" TO MANAGER-FNAME.
MOVE "Fillmore" TO MANAGER-LNAME.
MOVE 19 TO DEPT-NBR-EMPS.
MOVE 111111.11 TO DEPT-TOTAL-SALARIES.
COMPUTE DEPT-AVG-SALARY =
(DEPT-TOTAL-SALARIES / DEPT-NBR-EMPS).
*****
DISPLAY-DETAILS.
DISPLAY "Department Name: " DEPT-NAME.
DISPLAY "Department Location: " DEPT-LOC.
DISPLAY "Manager FNAME: " MANAGER-FNAME.
DISPLAY "Manager NAME: " MANAGER-FNAME.
DISPLAY "Department AVG Salary: " DEPT-AVG-SALARY.
DISPLAY "Number of employees: " DEPT-NBR-EMPS.

55 changes: 55 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/cbl/EMPPAY.CBL
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. EMPPAY.
AUTHOR. ASHIS KUMAR NAIK.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 REC-COUNTER PIC 9(1).
01 EMP-RECORD.
05 EMP-NAME.
10 EMP-FNAME PIC X(15) VALUE 'FRANCISCO'.
10 EMP-LNAME PIC X(15).
05 EMP-HOURLY-RATE PIC 9(3)V99.
05 EMP-OT-RATE PIC V99.
05 EMP-REWARD PIC V99.
05 EMP-HOURS PIC 9(3).
05 EMP-PAY-WEEK PIC 9(7)V99.
05 EMP-PAY-MONTH PIC 9(7)V99.

PROCEDURE DIVISION.
PERFORM INITIALIZATION.
PERFORM PAYMENT-WEEKLY.
PERFORM PAYMENT-MONTHLY.
PERFORM SHOW-OUTPUT.
STOP RUN.
INITIALIZATION.
MOVE "Millard" TO EMP-FNAME.
MOVE "Fillmore" TO EMP-LNAME.
MOVE 19 TO EMP-HOURS.
MOVE 23.50 TO EMP-HOURLY-RATE.
PAYMENT-WEEKLY.

IF EMP-HOURS >= 40
MOVE .25 TO EMP-OT-RATE
ELSE IF EMP-HOURS >= 50
MOVE .50 TO EMP-OT-RATE
ELSE
MOVE ZERO TO EMP-OT-RATE.
COMPUTE EMP-PAY-WEEK =
(EMP-HOURS * EMP-HOURLY-RATE) * (1 + EMP-OT-RATE).
PAYMENT-MONTHLY.

IF EMP-HOURS > 150
MOVE .50 TO EMP-REWARD
ELSE
MOVE ZERO TO EMP-REWARD.
COMPUTE EMP-PAY-MONTH =
(EMP-PAY-WEEK * 4) * (1 + EMP-REWARD).
SHOW-OUTPUT.
DISPLAY "Name: " EMP-NAME.
DISPLAY "Hours Worked Per Week: " EMP-HOURS.
DISPLAY "Hourly Rate: " EMP-HOURLY-RATE.
DISPLAY "Bonus-Rate: " EMP-OT-RATE.
DISPLAY "Gross Pay Per Week: " EMP-PAY-WEEK .
DISPLAY "Gross Pay Per Month: " EMP-PAY-MONTH .
DISPLAY "Hi Chris - how's Loretta today?".
14 changes: 14 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/jcl/DEPTPAY.JCL
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//DEPTPAYJ JOB 1,NOTIFY=&SYSUID
//COPY2DS1 EXEC PGM=IKJEFT01
//INUNIX DD PATHOPTS=(ORDONLY),
// PATH='/z/z99998/cobolcheck/CC##99.CBL'
//OUTMVS DD DSN=Z99998.CBL(DEPTPAY),DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
OCOPY IND(INUNIX) OUTDD(OUTMVS) TEXT CONVERT(YES) PATHOPTS(USE)
/*
//COBRUN EXEC IGYWCL
//COBOL.SYSIN DD DSN=Z99998.CBL(DEPTPAY),DISP=SHR
//LKED.SYSLMOD DD DSN=Z99998.LOAD(DEPTPAY),DISP=SHR
//RUN EXEC PGM=DEPTPAY
//STEPLIB DD DSN=Z99998.LOAD,DISP=SHR
21 changes: 21 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/jcl/EMPPAY.JCL
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//EMPPAY JOB 1,NOTIFY=&SYSUID
//***************************************************/
//* Copyright Contributors to the COBOL Programming Course
//* SPDX-License-Identifier: CC-BY-4.0
//***************************************************/
//COBRUN EXEC IGYWCL
//COBOL.SYSIN DD DSN=&SYSUID..CBL(EMPPAY),DISP=SHR
//LKED.SYSLMOD DD DSN=&SYSUID..LOAD(EMPPAY),DISP=SHR
//***************************************************/
// IF RC = 0 THEN
//***************************************************/
//RUN EXEC PGM=EMPPAY
//STEPLIB DD DSN=&SYSUID..LOAD,DISP=SHR
//ACCTREC DD DSN=&SYSUID..DATA,DISP=SHR
//PRTLINE DD SYSOUT=*,OUTLIM=15000
//SYSOUT DD SYSOUT=*,OUTLIM=15000
//CEEDUMP DD DUMMY
//SYSUDUMP DD DUMMY
//***************************************************/
// ELSE
// ENDIF
13 changes: 13 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/tests/deptpay.cut
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TestSuite "Average Salary"

TestCase 'NUMBER OF PERSON TO BE 19'
PERFORM AVERAGE-SALARY.
EXPECT DEPT-NBR-EMPS TO BE 19

TestCase 'TOTAL AVERAGE SALARY TO BE 111111.11'
PERFORM AVERAGE-SALARY.
EXPECT DEPT-TOTAL-SALARIES TO BE 111111.11

TestCase 'average salary will be greater than 5840'
PERFORM AVERAGE-SALARY.
EXPECT DEPT-AVG-SALARY >= 5840
25 changes: 25 additions & 0 deletions COBOL Programming Course #4 - Testing/Labs/tests/emppay.cut
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
TestSuite 'Checks the employee payment'

TestCase 'checks the EMP-OT-RATE TO be 0.25'
MOVE 50 TO EMP-HOURS
MOVE 23.50 TO EMP-HOURLY-RATE
PERFORM PAYMENT-WEEKLY
EXPECT EMP-OT-RATE TO BE 0.25

TestCase 'checks the EMP-PAY-WEEKLY > 900 if EMP-HOURS >= 40'
MOVE 40 TO EMP-HOURS
MOVE 23.50 TO EMP-HOURLY-RATE
PERFORM PAYMENT-WEEKLY
EXPECT EMP-PAY-WEEK >= 900

TestCase 'checks the EMP-PAY-WEEKLY > 1600 '
MOVE 60 TO EMP-HOURS
MOVE 23.50 TO EMP-HOURLY-RATE
PERFORM PAYMENT-WEEKLY
EXPECT EMP-PAY-WEEK >= 1600

TestCase 'checks the EMP-PAY-MONTHLY to be greater than 9600'
MOVE 160 TO EMP-HOURS
MOVE 1600 TO EMP-PAY-WEEK
PERFORM PAYMENT-MONTHLY
EXPECT EMP-PAY-MONTH >= 9600

0 comments on commit 91efa44

Please sign in to comment.