Commit 76c30bec authored by Justin Dearden's avatar Justin Dearden
Browse files

Version 2.1

Added more tests and ran them without any functions implemented
parent b2d392d1
......@@ -45,6 +45,87 @@ public class TrigFunctionTest {
}
/* Test case to check if the Factorial function exists
*
* */
@Test
public void testFactorialMethodExists() {
TrigFunctions.factorial(5);
}
/* Test case to check if the Power function exists
*
* */
@Test
public void testPowerMethodExists() {
TrigFunctions.power(5,4);
}
/* Test case to check if the toRadian function exists
*
* */
@Test
public void testRadianMethodExists() {
TrigFunctions.toRadian(180);
}
/* Test case to check if the sin function exists
*
* */
@Test
public void testSinMethodExists() {
TrigFunctions.sin(180);
}
/* Test case to check if the cos function exists
*
* */
@Test
public void testCosMethodExists() {
TrigFunctions.cos(180);
}
/* Test case to check if the tan function exists
*
* */
@Test
public void testTanMethodExists() {
TrigFunctions.tan(180);
}
/* Test case to check if the sin function takes a double
*
* */
@Test
public void testSinMethodTakesDouble() {
assertFalse(Double.isNaN(TrigFunctions.sin(2.5)));
}
/* Test case to check if the cos function takes a double
*
* */
@Test
public void testCosMethodTakesDouble() {
assertFalse(Double.isNaN(TrigFunctions.cos(2.5)));
}
/* Test case to check if the tan function takes a double
*
* */
@Test
public void testTanMethodTakesDouble() {
assertFalse(Double.isNaN(TrigFunctions.tan(2.5)));
}
//SIN TESTS
@Test
......
package assignment2B;
public class TrigFunctions {
public static double factorial(int i) {
if (i == 1) {
return 1;
}
return i * TrigFunctions.factorial(i - 1);
}
public static double power(double base, double power) {
double results = base;
for (int j = 1; j < power; j++) {
results = results * base;
}
return results;
}
public static double toRadian(double degrees) {
double result = degrees * (3.141592653589793 / 180);
return result;
}
public static double sin(double degrees) {
return 0;
}
public static double cos(double degrees) {
return 0;
}
public static double tan(double degrees) {
return 0;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment