123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
-
- import static org.junit.Assert.*;
- import org.junit.Test;
-
- /**
- * The test class ScientificFeaturesTest.
- */
- public class ScientificFeaturesTest
- {
- Console console = new Console();
- ScientificFeatures test = new ScientificFeatures(console);
-
- @Test
- public void switchDisplayModeTest(){
- //Given
-
- String test1 = "binary";
- //When
- int actual = 2;
- int expected = test.switchDisplayMode(test1);
- //Then
- assertEquals(expected,actual);
- }
-
- @Test
- public void switchUnitsModeTest(){
- //Given;
- String test1 = "radians";
- //When
- String actual = "radians";
- String expected = test.switchUnitsMode(test1);
- //Then
- assertEquals(expected,actual);
- }
-
- @Test
- public void sineTest(){
- //Given
-
- double test1 = 90;
-
- //When
- double actual = 1.0;
- double expected = test.sine(test1);
- //Then
- assertEquals(expected,actual,.11);
- }
-
- @Test
- public void cosineTest(){
- //Given
-
- double test1 = 180.0;
-
- //When
- double actual = -1.0;
- double expected = test.cosine(test1);
- //Then
- assertEquals(expected,actual,0);
- }
-
- @Test
- public void tangentTest(){
- //Given
-
- double test1 = 0.0;
-
- //When
- double actual = 0.0;
- double expected = test.tangent(test1);
- //Then
- assertEquals(expected,actual,.0001);
- }
-
- @Test
- public void invSineTest(){
- //Given
-
- double test1 = 0.0;
-
- //When
- double actual = 0.0;
- double expected = test.invSine(test1);
- //Then
- assertEquals(expected,actual,0);
- }
-
- @Test
- public void invCosineTest(){
- //Given
-
- double test1 = 0.0;
-
- //When
- double actual = 1.57;
- double expected = test.invCosine(test1);
- //Then
- assertEquals(expected,actual,.01);
- }
-
- @Test
- public void invTangentTest(){
- //Given
-
- double test1 = 0.0;
-
- //When
- double actual = 0.0;
- double expected = test.invTangent(test1);
- //Then
- assertEquals(expected,actual,0);
- }
- }
-
-
|