|
@@ -0,0 +1,139 @@
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+import static org.junit.Assert.*;
|
|
4
|
+import org.junit.After;
|
|
5
|
+import org.junit.Before;
|
|
6
|
+import org.junit.Test;
|
|
7
|
+
|
|
8
|
+/**
|
|
9
|
+ * The test class BasicTest.
|
|
10
|
+ *
|
|
11
|
+ * @author (your name)
|
|
12
|
+ * @version (a version number or a date)
|
|
13
|
+ */
|
|
14
|
+public class BasicTest
|
|
15
|
+{
|
|
16
|
+ /**
|
|
17
|
+ * Default constructor for test class BasicTest
|
|
18
|
+ */
|
|
19
|
+ public BasicTest()
|
|
20
|
+ {
|
|
21
|
+ }
|
|
22
|
+
|
|
23
|
+ /**
|
|
24
|
+ * Sets up the test fixture.
|
|
25
|
+ *
|
|
26
|
+ * Called before every test case method.
|
|
27
|
+ */
|
|
28
|
+ @Before
|
|
29
|
+ public void setUp()
|
|
30
|
+ {
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ /**
|
|
34
|
+ * Tears down the test fixture.
|
|
35
|
+ *
|
|
36
|
+ * Called after every test case method.
|
|
37
|
+ */
|
|
38
|
+ @After
|
|
39
|
+ public void tearDown()
|
|
40
|
+ {
|
|
41
|
+ }
|
|
42
|
+
|
|
43
|
+ @Test
|
|
44
|
+ public void testAdd()
|
|
45
|
+ {
|
|
46
|
+ Basic basic1 = new Basic();
|
|
47
|
+ assertEquals(14, basic1.getSum(4, 10), 0.1);
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ @Test
|
|
51
|
+ public void testAddDec()
|
|
52
|
+ {
|
|
53
|
+ Basic basic1 = new Basic();
|
|
54
|
+ assertEquals(13.27, basic1.getSum(13.2, 0.07), 0.1);
|
|
55
|
+ }
|
|
56
|
+
|
|
57
|
+ @Test
|
|
58
|
+ public void testAddNeg()
|
|
59
|
+ {
|
|
60
|
+ Basic basic1 = new Basic();
|
|
61
|
+ basic1.Basic();
|
|
62
|
+ assertEquals(6, basic1.getSum(-3, 9), 0.1);
|
|
63
|
+ }
|
|
64
|
+
|
|
65
|
+ @Test
|
|
66
|
+ public void testSub()
|
|
67
|
+ {
|
|
68
|
+ Basic basic1 = new Basic();
|
|
69
|
+ assertEquals(5, basic1.getDiff(10, 5), 0.1);
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ @Test
|
|
73
|
+ public void testSubDec()
|
|
74
|
+ {
|
|
75
|
+ Basic basic1 = new Basic();
|
|
76
|
+ assertEquals(4.65, basic1.getDiff(13.2, 8.55), 0.1);
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+ @Test
|
|
80
|
+ public void testSubNeg()
|
|
81
|
+ {
|
|
82
|
+ Basic basic1 = new Basic();
|
|
83
|
+ assertEquals(18, basic1.getDiff(6, -12), 0.1);
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ @Test
|
|
87
|
+ public void testMul()
|
|
88
|
+ {
|
|
89
|
+ Basic basic1 = new Basic();
|
|
90
|
+ assertEquals(15, basic1.getProduct(3, 5), 0.1);
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ @Test
|
|
94
|
+ public void testMulDec()
|
|
95
|
+ {
|
|
96
|
+ Basic basic1 = new Basic();
|
|
97
|
+ assertEquals(6.8, basic1.getProduct(3.4, 2), 0.1);
|
|
98
|
+ }
|
|
99
|
+
|
|
100
|
+ @Test
|
|
101
|
+ public void testMulNeg()
|
|
102
|
+ {
|
|
103
|
+ Basic basic1 = new Basic();
|
|
104
|
+ assertEquals(10, basic1.getProduct(-2, -5), 0.1);
|
|
105
|
+ }
|
|
106
|
+
|
|
107
|
+ @Test
|
|
108
|
+ public void testDiv()
|
|
109
|
+ {
|
|
110
|
+ Basic basic1 = new Basic();
|
|
111
|
+ assertEquals(4, basic1.getQuotient(12, 3), 0.1);
|
|
112
|
+ }
|
|
113
|
+
|
|
114
|
+ @Test
|
|
115
|
+ public void testDivDec()
|
|
116
|
+ {
|
|
117
|
+ Basic basic1 = new Basic();
|
|
118
|
+ assertEquals(7.4, basic1.getQuotient(14.8, 2), 0.1);
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ @Test
|
|
122
|
+ public void testDivNeg()
|
|
123
|
+ {
|
|
124
|
+ Basic basic1 = new Basic();
|
|
125
|
+ assertEquals(-3, basic1.getQuotient(-12, 4), 0.1);
|
|
126
|
+ }
|
|
127
|
+}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|