123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- import org.junit.Assert;
- import org.junit.Test;
-
- /**
- * The test class ScientificFunctionsTest.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class ScientificFunctionsTest
- { ScientificFunctions scientificFunctionsTest = new ScientificFunctions();
- /**
- * Default constructor for test class ScientificFunctionsTest
- */
- public ScientificFunctionsTest()
- {
- }
-
- @Test
- public void testSquared(){
- double actual = ScientificFunctions.sqr(4);
- double expected = 16;
- Assert.assertEquals(expected,actual,1e-8);
- }
-
- @Test
- public void testSqRoot(){
- double actual = ScientificFunctions.sqRoot(4);
- double expected = 2;
- Assert.assertEquals(expected,actual,1e-8);
- }
-
- @Test
- public void testInvFraction(){
- double actual = ScientificFunctions.invFraction(2);
- double expected = .5;
- Assert.assertEquals(expected,actual,1e-8);
- }
-
- @Test
- public void testInvSign(){
- double actual = ScientificFunctions.invSign(3);
- double expected = -3;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testCosine(){
- double actual = ScientificFunctions.cosine(3);
- double expected = 0.9986295347545738;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testSine(){
- double actual = ScientificFunctions.sin(3);
- double expected = 0.05233595624294383;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testTan(){
- double actual = ScientificFunctions.tan(3);
- double expected = 0.052407779283041196;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testAcosine(){
- double actual = ScientificFunctions.acosin(3);
- double expected = 1.518412495074819;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testAsin(){
- double actual = ScientificFunctions.asin(3);
- double expected = 0.05238383172007756;
- Assert.assertEquals(expected,actual,1e-8);
- }
- @Test
- public void testATangent(){
- double actual = ScientificFunctions.atan(3);
- double expected = 0.05231210692238478;
- Assert.assertEquals(expected,actual,1e-8);
- }
-
-
- }
|