Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Justin Dearden
Assignment 2b
Commits
76c30bec
Commit
76c30bec
authored
Feb 24, 2020
by
Justin Dearden
Browse files
Version 2.1
Added more tests and ran them without any functions implemented
parent
b2d392d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
58 deletions
+81
-58
src/assignment2B/TrigFunctionTest.java
src/assignment2B/TrigFunctionTest.java
+81
-0
src/assignment2B/TrigFunctions.java
src/assignment2B/TrigFunctions.java
+0
-58
No files found.
src/assignment2B/TrigFunctionTest.java
View file @
76c30bec
...
...
@@ -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
...
...
src/assignment2B/TrigFunctions.java
View file @
76c30bec
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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment