Skip to content

tests #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,65 @@
/*

package com.zipcodewilmington.scientificcalculator;

public class Scientific {
private static double value;

public static Double tan (double value) {
value = 0;
value = Math.tan(value);
return value;
}

public Double tanR(double value) {
value = 0;
value = Math.atan(value);
return value;
}


public Double cos(double value) {
value = 0;
value = Math.cos(value);
return value;
}

public double sin(double value) {
value = 0;
value = Math.sin(value);
return value;
}

public double cb(double value) {
value = 0;
value= Math.pow(value, 3);
return value;
}

public double sqrt(double value) {
value = 0;
value = Math.sqrt(value);
return value;
}

public double squ(double value) {
value = 0;
value = Math.pow(value, 2);
return value;
}


public double sinR(double value) {
value = 0;
value = Math.asin(value);
return value;
}
public double cosR(double value){
value = 0;
value = Math.acos(value);
return value;
}
}
/*public double result;
public static void main(String[] args) {
int firstNum = 0;
double value = 0.0;
Expand Down Expand Up @@ -83,10 +140,18 @@ public static boolean isRadian ( double input){
if (Math.round(to180) == 57) {
return true;
} else {
<<<<<<< HEAD
}
return false;
}
*/

/*=======
}return false;


}
}
}
*/
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.zipcodewilmington.scientific_calculator;

import com.zipcodewilmington.scientificcalculator.CalculatorEngine;
import com.zipcodewilmington.scientificcalculator.Scientific;
import org.junit.Assert;
import org.junit.Test;

public class ScientificTest {
@Test
public void testTan() {
Scientific scientific = new Scientific();
Double value;
value = scientific.tan(7);
if (value == 0.122784560)
{ //
Assert.fail();
}
}
@Test
public void testTanR() {
Scientific scientific = new Scientific();
Double value;
value = scientific.tanR(0.10955952677);
if (value == Math.atan(.11))
{ //
Assert.fail();
}
}
@Test
public void testCos(){
Scientific scientific = new Scientific();
Double value;
value = scientific.cos(-0.4480736161291702);
if (value == Math.cos(90.0)){
Assert.fail();
}
}
@Test
public void testCosR(){
Scientific scientific = new Scientific();
Double value;
value = scientific.cos(1.0);
if (value == Math.acos(-1.99)){
Assert.fail();
}
}
@Test
public void testSine (){
Scientific scientific = new Scientific();
double value;
value = scientific.sin(0.8939966636005579);
if (value != scientific.sin(90)){
Assert.fail();
}
}
@Test
public void testSineR (){
Scientific scientific = new Scientific();
double value;
value = scientific.sinR(8);
if (value != scientific.sinR(5.0)){
Assert.fail();
}
}
@Test
public void testCubed (){
Scientific scientific = new Scientific();
double value;
value = scientific.cb(3);
if (value != scientific.cb(10)){
Assert.fail();
}
}
@Test
public void testSqrt (){
Scientific scientific = new Scientific();
double value;
value = scientific.sqrt(25);
if (value != scientific.sqrt(5)){
Assert.fail();
}
}
@Test
public void testSquare (){
Scientific scientific = new Scientific();
double value;
value = scientific.squ(5);
if (value != scientific.squ(25)){
Assert.fail();
}
}
}