De'Jon Johnson hace 6 años
padre
commit
5dc65a8762
Se han modificado 3 ficheros con 186 adiciones y 4 borrados
  1. 4
    4
      Memory.java
  2. 77
    0
      TrigonometryTest.java
  3. 105
    0
      simpleOpTest.java

+ 4
- 4
Memory.java Ver fichero

25
     
25
     
26
     public static double resetMemory(){
26
     public static double resetMemory(){
27
         memory[0] = 0;
27
         memory[0] = 0;
28
-        simpleOp.currentNumber = 0;
29
-        return simpleOp.currentNumber;
28
+        Console.currentNumber = 0;
29
+        return Console.currentNumber;
30
     }
30
     }
31
     
31
     
32
     public static double recallMemory(){
32
     public static double recallMemory(){
33
         //simpleOp.currentNumber = memory[0];
33
         //simpleOp.currentNumber = memory[0];
34
         //System.out.println(memory[0]);
34
         //System.out.println(memory[0]);
35
-        simpleOp.currentNumber = memory[0];
36
-        return simpleOp.currentNumber;
35
+        Console.currentNumber = memory[0];
36
+        return Console.currentNumber;
37
     }
37
     }
38
 }
38
 }

+ 77
- 0
TrigonometryTest.java Ver fichero

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 TrigonometryTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class TrigonometryTest
15
+{
16
+    /**
17
+     * Default constructor for test class TrigonometryTest
18
+     */
19
+    public TrigonometryTest()
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 TanTrigTest()
45
+    {
46
+        assertEquals(-0.5872139151569291, Trigonometry.tan(100), 0.1);
47
+    }
48
+
49
+    @Test
50
+    public void CosTrigTest()
51
+    {
52
+        assertEquals(0.8623188722876839, Trigonometry.cos(100), 0.1);
53
+    }
54
+
55
+    @Test
56
+    public void ATanTrigTest()
57
+    {
58
+        assertEquals(1.5607966601082315, Trigonometry.tanInverse(100), 0.1);
59
+    }
60
+
61
+    @Test
62
+    public void ACosTrigTest()
63
+    {
64
+        assertEquals(3.141592653589793, Trigonometry.cosInverse(-1), 0.1);
65
+    }
66
+
67
+    @Test
68
+    public void ASinTrigTest()
69
+    {
70
+        assertEquals(-1.5707963267948966, Trigonometry.sinInverse(-1), 0.1);
71
+    }
72
+}
73
+
74
+
75
+
76
+
77
+

+ 105
- 0
simpleOpTest.java Ver fichero

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 simpleOpTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class simpleOpTest
15
+{
16
+    /**
17
+     * Default constructor for test class simpleOpTest
18
+     */
19
+    public simpleOpTest()
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 AddSimpleOpTest()
45
+    {
46
+        assertEquals(8.0, simpleOp.add(4, 4), 0.1);
47
+    }
48
+
49
+    @Test
50
+    public void SqrtSimpleOpTest()
51
+    {
52
+        assertEquals(2.0, simpleOp.sqrt(4), 0.1);
53
+    }
54
+
55
+    @Test
56
+    public void ExpSimpleOps()
57
+    {
58
+        assertEquals(27.0, simpleOp.exp(3, 3), 0.1);
59
+    }
60
+
61
+    @Test
62
+    public void MulSimpleOpTest()
63
+    {
64
+        assertEquals(4.0, simpleOp.mul(2, 2), 0.1);
65
+    }
66
+
67
+    @Test
68
+    public void InvertSimpleOpsTest()
69
+    {
70
+        assertEquals(-3.0, simpleOp.invert(3), 0.1);
71
+    }
72
+
73
+    @Test
74
+    public void SubSimpleOpTest()
75
+    {
76
+        assertEquals(1.0, simpleOp.sub(3, 2), 0.1);
77
+    }
78
+
79
+    @Test
80
+    public void SqurSimpleOpTestMethod()
81
+    {
82
+        assertEquals(100.0, simpleOp.squ(10), 0.1);
83
+    }
84
+
85
+    @Test
86
+    public void InverseSimpleOps()
87
+    {
88
+        assertEquals(0.25, simpleOp.inv(4), 0.1);
89
+    }
90
+
91
+    @Test
92
+    public void DivSimpleOpsTest()
93
+    {
94
+        assertEquals(5.0, simpleOp.div(10, 2), 0.1);
95
+    }
96
+}
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+