Skip to content
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

added the first few basic test cases #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.idea/**/tasks.xml
.idea/dictionaries

.DS_Store

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<groupId>com.zipcodewilmington</groupId>
<artifactId>scientific_calculator</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.zipcodewilmington.scientificcalculator;

public class CalculatorCore {

public double addition(double x, double y) {
return (x + y);
}

;

public double subtraction(double x, double y) {
return (x - y);
}

;

public double multiplication(double x, double y) {
return (x * y);
}

;

public double division(double x, double y) {
return (x / y);
}

;

public double square(double x) {
return x * x;
}

;

public void sqrt(double x) { return; }

;

public void exponent(double x) { return; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.zipcodewilmington.scientificcalculator;

public class CalculatorScientific {

void add(int x, int y) {
return;
}

;

void subtract(int x, int y) {
return;
}

;

void multiply(int x, int y) {
return;
}

;

void divide(int x, int y) {
return;
}

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

import com.zipcodewilmington.scientificcalculator.CalculatorCore;
import com.zipcodewilmington.scientificcalculator.CalculatorScientific;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.assertEquals;

/**
* Created by leon on 2/9/18.
*/

public class CalculatorCoreTest {
private CalculatorCore objCalcUnderTest;

@Before
public void setUp() {
objCalcUnderTest = new CalculatorCore();
}

@Test
public void additionTest() {
//Gerkin Statement IF WHEN THEN
//If
double firstValue = 1.5; double secondValue = 2;
double expected = 3.5;

//When
CalculatorCore calculator = new CalculatorCore();
double actual = calculator.addition(firstValue, secondValue);

//Then
assertEquals(actual, expected, 0.01d);
}

@Test
public void subtractionTest() {
//If
double firstValue = 5.5; double secondValue = 2.0;
double expected = 3.5;

//When
CalculatorCore calculator = new CalculatorCore();
double actual = calculator.subtraction(firstValue, secondValue);

//Then
assertEquals(actual, expected, 0.01d);
}

@Test
public void multiplicationTest() {
//If
double firstValue = 5; double secondValue = 2;
double expected = 10;

//When
CalculatorCore calculator = new CalculatorCore();
double actual = calculator.multiplication(firstValue, secondValue);

//Then
assertEquals(actual, expected, 0.01d);
}

@Test
public void divisionTest() {
//If
double firstValue = 6; double secondValue = 2;
double expected = 3;

//When
CalculatorCore calculator = new CalculatorCore();
double actual = calculator.division(firstValue, secondValue);

//Then
assertEquals(actual, expected, 0.01d);
}

@Test
public void squareTest() {
//If
double num1 = 5;
double expected = 25;

//When
CalculatorCore calculator = new CalculatorCore();
double actual = calculator.square(num1);

//Then
assertEquals(actual, expected, 0.01d);
}
}

This file was deleted.

8 changes: 8 additions & 0 deletions theplan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
THE SCIENTIFIC CALCULATOR PLAN!!!

Basic Calculator: Mary
Scientific Functions: Kyle
Testing: Mike


Mike added something 1