From 185a0a63116fb32e31addc7af18491e0675a4deb Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Sat, 25 Jun 2022 13:36:13 -0400 Subject: [PATCH 1/5] updated .gitignore and added theplan.md --- .gitignore | 2 ++ theplan.md | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 theplan.md 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/theplan.md b/theplan.md new file mode 100644 index 0000000..c96f06a --- /dev/null +++ b/theplan.md @@ -0,0 +1,7 @@ +THE SCIENTIFIC CALCULATOR PLAN!!! + +Basic Calculator: +Scientific Functions: +Testing: + + From 1f29b262e4106701fef1762e4d28241af45f5b15 Mon Sep 17 00:00:00 2001 From: Kyle Welch Date: Sat, 25 Jun 2022 15:00:45 -0400 Subject: [PATCH 2/5] the roles are set --- theplan.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/theplan.md b/theplan.md index c96f06a..eaa803d 100644 --- a/theplan.md +++ b/theplan.md @@ -1,7 +1,5 @@ THE SCIENTIFIC CALCULATOR PLAN!!! -Basic Calculator: -Scientific Functions: -Testing: - - +Basic Calculator: Mary +Scientific Functions: Kyle +Testing: Mike From 5e9322ae66e9a7b729480ba411745f9d90bb907e Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 25 Jun 2022 16:21:21 -0400 Subject: [PATCH 3/5] mike is testing git push --- theplan.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/theplan.md b/theplan.md index eaa803d..3101192 100644 --- a/theplan.md +++ b/theplan.md @@ -3,3 +3,6 @@ THE SCIENTIFIC CALCULATOR PLAN!!! Basic Calculator: Mary Scientific Functions: Kyle Testing: Mike + + +Mike added something From 7e73ed0e5b1d6e150daae1a6073fd3fc2a12aa74 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 25 Jun 2022 17:07:05 -0400 Subject: [PATCH 4/5] test commit --- theplan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theplan.md b/theplan.md index 3101192..4b80b9b 100644 --- a/theplan.md +++ b/theplan.md @@ -5,4 +5,4 @@ Scientific Functions: Kyle Testing: Mike -Mike added something +Mike added something 1 From 25668a44b07ca461cb4330341c6f344ac9bfe1cb Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 26 Jun 2022 11:30:13 -0400 Subject: [PATCH 5/5] started basic test cases --- pom.xml | 8 ++ .../scientificcalculator/CalculatorCore.java | 40 ++++++++ .../CalculatorScientific.java | 28 ++++++ .../CalculatorCoreTest.java | 91 +++++++++++++++++++ .../TestMainApplication.java | 7 -- 5 files changed, 167 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorCore.java create mode 100644 src/main/java/com/zipcodewilmington/scientificcalculator/CalculatorScientific.java create mode 100644 src/test/java/com/zipcodewilmington/scientific_calculator/CalculatorCoreTest.java delete mode 100644 src/test/java/com/zipcodewilmington/scientific_calculator/TestMainApplication.java 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 { -}