소스 검색

added test for inverse sine

Margaret Pierse 6 년 전
부모
커밋
df5f622885
3개의 변경된 파일20개의 추가작업 그리고 15개의 파일을 삭제
  1. 5
    7
      MathMethods.java
  2. 7
    0
      MathMethodsTest.java
  3. 8
    8
      package.bluej

+ 5
- 7
MathMethods.java 파일 보기

@@ -10,7 +10,7 @@ public class MathMethods
10 10
 
11 11
 {
12 12
     private static int displayModeCounter=4;
13
-    
13
+
14 14
     public static Double add(double n1, double n2){
15 15
         return (n1 + n2);
16 16
     }
@@ -54,8 +54,6 @@ public class MathMethods
54 54
 
55 55
     }
56 56
 
57
-    //**********************************************************
58
-    //Errors in iSin, returns NaN
59 57
     public static double iSin(double n1){
60 58
         return (Math.asin(n1));
61 59
 
@@ -128,11 +126,11 @@ public class MathMethods
128 126
         }
129 127
         return answer;
130 128
     }
131
-    
129
+
132 130
     public static double randomNumber() {
133
-    Random rand = new Random();
134
-    return rand.nextDouble()*101;
135
-    
131
+        Random rand = new Random();
132
+        return rand.nextDouble()*101;
133
+
136 134
     }
137 135
 
138 136
     public static void printAns(String printAnswer){

+ 7
- 0
MathMethodsTest.java 파일 보기

@@ -85,6 +85,12 @@ public class MathMethodsTest
85 85
         // mathMethods1.memory = 20;
86 86
         // assertEquals(0 24, MathMethods.switchDisplayMode("octal"));
87 87
     // }
88
+
89
+    @Test
90
+    public void testInverseSine()
91
+    {
92
+        assertEquals(1.5707963267948966, MathMethods.iSin(1), 0.1);
93
+    }
88 94
 }
89 95
 
90 96
 
@@ -94,3 +100,4 @@ public class MathMethodsTest
94 100
 
95 101
 
96 102
 
103
+

+ 8
- 8
package.bluej 파일 보기

@@ -2,15 +2,15 @@
2 2
 dependency1.from=MathMethodsTest
3 3
 dependency1.to=MathMethods
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=Calculator
6
-dependency2.to=MathMethods
5
+dependency2.from=MathMethods
6
+dependency2.to=Calculator
7 7
 dependency2.type=UsesDependency
8
-dependency3.from=MathMethods
9
-dependency3.to=Calculator
8
+dependency3.from=Calculator
9
+dependency3.to=MathMethods
10 10
 dependency3.type=UsesDependency
11
-editor.fx.0.height=813
12
-editor.fx.0.width=1078
13
-editor.fx.0.x=294
11
+editor.fx.0.height=817
12
+editor.fx.0.width=695
13
+editor.fx.0.x=707
14 14
 editor.fx.0.y=23
15 15
 objectbench.height=80
16 16
 objectbench.width=480
@@ -18,7 +18,7 @@ package.divider.horizontal=0.5997536945812808
18 18
 package.divider.vertical=0.8838451268357811
19 19
 package.editor.height=655
20 20
 package.editor.width=706
21
-package.editor.x=356
21
+package.editor.x=608
22 22
 package.editor.y=23
23 23
 package.frame.height=807
24 24
 package.frame.width=832