add branching, addition, looping, and assignment tests
This commit is contained in:
parent
53914aebfa
commit
87aef13265
|
|
@ -129,4 +129,32 @@ UTEST_F(InterpreterTestFile, quadratic) {
|
|||
utest_fixture->evaluated_file = "samples/outputs/quadratic_evaluate.txt";
|
||||
}
|
||||
|
||||
UTEST_F(InterpreterTestFile, sorting) {
|
||||
utest_fixture->test_file = "samples/sorting-snippet.cbl";
|
||||
utest_fixture->print_file = "samples/outputs/sorting_print.txt";
|
||||
utest_fixture->evaluated_file = "samples/outputs/sorting_evaluate.txt";
|
||||
}
|
||||
|
||||
UTEST_F(InterpreterTestFile, assignment) {
|
||||
utest_fixture->test_file = "samples/assignment.cbl";
|
||||
utest_fixture->print_file = "samples/outputs/assignment_print.txt";
|
||||
utest_fixture->evaluated_file = "samples/outputs/assignment_evaluate.txt";
|
||||
}
|
||||
|
||||
UTEST_F(InterpreterTestFile, addition) {
|
||||
utest_fixture->test_file = "samples/addition.cbl";
|
||||
utest_fixture->print_file = "samples/outputs/addition_print.txt";
|
||||
utest_fixture->evaluated_file = "samples/outputs/addition_evaluate.txt";
|
||||
}
|
||||
|
||||
UTEST_F(InterpreterTestFile, branching) {
|
||||
utest_fixture->test_file = "samples/branching.cbl";
|
||||
utest_fixture->print_file = "samples/outputs/branching_print.txt";
|
||||
utest_fixture->evaluated_file = "samples/outputs/branching_evaluate.txt";
|
||||
}
|
||||
|
||||
UTEST_F(InterpreterTestFile, looping) {
|
||||
utest_fixture->test_file = "samples/looping.cbl";
|
||||
utest_fixture->print_file = "samples/outputs/looping_print.txt";
|
||||
utest_fixture->evaluated_file = "samples/outputs/looping_evaluate.txt";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. ADDITION.
|
||||
PROCEDURE DIVISION.
|
||||
COMPUTE A = 1 + 1
|
||||
DISPLAY A
|
||||
STOP RUN.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. ASSIGNMENT.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
05 A PIC 9(2).
|
||||
PROCEDURE DIVISION.
|
||||
MOVE 1 TO A
|
||||
DISPLAY A
|
||||
STOP RUN.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. BRANCHING.
|
||||
PROCEDURE DIVISION.
|
||||
IF A > B THEN
|
||||
DISPLAY 'A is greater than B'
|
||||
ELSE
|
||||
DISPLAY 'B is greater than A'
|
||||
END-IF
|
||||
STOP RUN.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. LOOPING.
|
||||
PROCEDURE DIVISION.
|
||||
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 10
|
||||
DISPLAY I
|
||||
END-PERFORM
|
||||
STOP RUN.
|
||||
|
|
@ -0,0 +1 @@
|
|||
2
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
section
|
||||
section
|
||||
section
|
||||
compute A = (1+1);
|
||||
print A;
|
||||
stop run
|
||||
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
section
|
||||
section
|
||||
section
|
||||
section
|
||||
A = ();
|
||||
section
|
||||
move 1 to A;
|
||||
print A;
|
||||
stop run
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
Original Array Contents:
|
||||
---------------------
|
||||
Element +0001: 30
|
||||
Element +0002: 10
|
||||
Element +0003: 50
|
||||
Element +0004: 20
|
||||
Element +0005: 40
|
||||
|
||||
Sorted Array Contents:
|
||||
--------------------
|
||||
Element +0001: 10
|
||||
Element +0002: 20
|
||||
Element +0003: 30
|
||||
Element +0004: 40
|
||||
Element +0005: 50
|
||||
Binary file not shown.
Loading…
Reference in New Issue