diff --git a/.gitignore b/.gitignore index de469bb..b09d082 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ .idea/**/tasks.xml .idea/dictionaries +.DS_Store + # Sensitive or high-churn files: .idea/**/dataSources/ .idea/**/dataSources.ids diff --git a/pom.xml b/pom.xml index e7cb4f6..43028b2 100644 --- a/pom.xml +++ b/pom.xml @@ -7,6 +7,14 @@ com.zipcodewilmington scientific_calculator 1.0-SNAPSHOT + + + junit + junit + 4.13.1 + test + + \ No newline at end of file diff --git a/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorCore.java b/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorCore.java new file mode 100644 index 0000000..b4d15dc --- /dev/null +++ b/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorCore.java @@ -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; } +} \ No newline at end of file diff --git a/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorScientific.java b/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorScientific.java new file mode 100644 index 0000000..cc9cf5c --- /dev/null +++ b/src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorScientific.java @@ -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; + } + + ; +} diff --git a/src/test/java/com/zipcodewilmington/scientific_calculator/CalculatorCoreTest.java b/src/test/java/com/zipcodewilmington/scientific_calculator/CalculatorCoreTest.java new file mode 100644 index 0000000..6ae44ae --- /dev/null +++ b/src/test/java/com/zipcodewilmington/scientific_calculator/CalculatorCoreTest.java @@ -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); + } +} diff --git a/src/test/java/com/zipcodewilmington/scientific_calculator/TestMainApplication.java b/src/test/java/com/zipcodewilmington/scientific_calculator/TestMainApplication.java deleted file mode 100644 index 94e8d98..0000000 --- a/src/test/java/com/zipcodewilmington/scientific_calculator/TestMainApplication.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.zipcodewilmington.scientific_calculator; - -/** - * Created by leon on 2/9/18. - */ -public class TestMainApplication { -} diff --git a/theplan.md b/theplan.md new file mode 100644 index 0000000..4b80b9b --- /dev/null +++ b/theplan.md @@ -0,0 +1,8 @@ +THE SCIENTIFIC CALCULATOR PLAN!!! + +Basic Calculator: Mary +Scientific Functions: Kyle +Testing: Mike + + +Mike added something 1