-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculatorUnitTest.java
109 lines (83 loc) · 3.18 KB
/
CalculatorUnitTest.java
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
/** ***********************************************************************************************************************
* CalculatorUnitTest - Runs a series of calculator usage and entry tests, bypassing user input.
* public final class
* Creates all Session types.
* Calls print() all types.
* Uses toString() on all types.
*
* TODO allow for pi
*
* input @param: none
* return value: none
* ***********************************************************************************************************************
*/
public final class CalculatorUnitTest {
public CalculatorUnitTest() {
//stub constructor
}
public static void runUnitTests() {
Session sessionIsSqrt = new Session("U","sqrt", "4");
//sessionIsSqrt.setAnswer();
sessionIsSqrt.print();
System.out.println(sessionIsSqrt.toString());
System.out.println(" ");
Session sessionIsLog = new Session("U","log", "4");
//sessionIsLog.setAnswer();
sessionIsLog.print();
System.out.println(sessionIsLog.toString());
System.out.println(" ");
Session sessionIsAddition = new Session("B","+", "5", "3");
//sessionIsAddition.setAnswer();
sessionIsAddition.print();
System.out.println(sessionIsAddition.toString());
System.out.println(" ");
Session sessionIsSubtraction = new Session("B","-", "4", "3");
sessionIsSubtraction.print();
System.out.println(sessionIsSubtraction.toString());
System.out.println(" ");
Session sessionSave = new Session("C","save");
sessionSave.print();
System.out.println(sessionSave.toString());
System.out.println(" ");
Session sessionIsMultiplication = new Session("B","*", "3", "2");
sessionIsMultiplication.print();
System.out.println(sessionIsMultiplication.toString());
System.out.println(" ");
Session sessionIsDivision = new Session("B","/", "4", "3");
sessionIsDivision.print();
System.out.println(sessionIsDivision.toString());
System.out.println(" ");
Session sessionRecall = new Session("C","recall");
sessionRecall.print();
System.out.println(sessionRecall.toString());
System.out.println(" ");
Session sessionIsRaiseToPower = new Session("B","^", "2", "3");
sessionIsRaiseToPower.print();
System.out.println(sessionIsRaiseToPower.toString());
System.out.println(" ");
Session sessionIsModulo = new Session("B","%", "5", "2");
sessionIsModulo.print();
System.out.println(sessionIsModulo.toString());
System.out.println(" ");
Session sessionIsUsingPi = new Session("B","+", "pi", "2");
//sessionIsUsingPi.print();
System.out.println(sessionIsUsingPi.toString());
System.out.println(" ");
Session sessionIsNegative = new Session("B","+", "-3", "2");
sessionIsNegative.print();
System.out.println(sessionIsNegative.toString());
System.out.println(" ");
Session sessionIsDoubleNegative = new Session("B","+", "-3", "-2");
sessionIsDoubleNegative.print();
System.out.println(sessionIsDoubleNegative.toString());
System.out.println(" ");
Session sessionPrint = new Session("C","print");
sessionPrint.print();
System.out.println(sessionPrint.toString());
System.out.println(" ");
Session sessionOff = new Session("C","off");
sessionOff.print();
System.out.println(sessionOff.toString());
System.out.println(" ");
}
}