Browse Source

tests done

Seth 6 years ago
parent
commit
b7b9e20fa9
2 changed files with 72 additions and 0 deletions
  1. 2
    0
      Calculator.java
  2. 70
    0
      MathMethodsTest.java

+ 2
- 0
Calculator.java View File

@@ -151,6 +151,8 @@ class Calculator{
151 151
                     memory = result;
152 152
                     calc.printAns(String.valueOf(result));
153 153
                     break;
154
+                    
155
+                    
154 156
                 }
155 157
             }
156 158
         }

+ 70
- 0
MathMethodsTest.java View File

@@ -0,0 +1,70 @@
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 MathMethodsTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class MathMethodsTest
15
+{
16
+    /**
17
+     * Default constructor for test class MathMethodsTest
18
+     */
19
+    public MathMethodsTest()
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 squareTest()
45
+    {
46
+        assertEquals(16, MathMethods.square(4), 0.1);
47
+    }
48
+
49
+    @Test
50
+    public void inverseTest()
51
+    {
52
+        assertEquals(5, MathMethods.inverse(5), 0.1);
53
+    }
54
+
55
+    @Test
56
+    public void tangentTest()
57
+    {
58
+        assertEquals(-3.380515005246586, MathMethods.tangent(5), 0.1);
59
+    }
60
+
61
+    @Test
62
+    public void inverseTangentTest()
63
+    {
64
+        assertEquals(1.550798992821746, MathMethods.iTan(50), 0.1);
65
+    }
66
+}
67
+
68
+
69
+
70
+