Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RaulGracia/playground
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulGracia committed Apr 17, 2018
2 parents 396a6e3 + 8a83ce2 commit 1c7c14c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/main/java/MyCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,22 @@ public double divide (int a, int b) {
return ((double)a)/b;
}

public int multilply (int a, int b) {
public int multiply(int a, int b) {
return a*b;
}

public double sum (double a, double b) {
return a+b;
}

public double subtract (double a, double b) {
return a-b;
}

public double divide (double a, double b) { return a/b;}

public double multiply(double a, double b) {
return a*b;
}

}
26 changes: 25 additions & 1 deletion src/test/java/MyCalculatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,31 @@ public void divideTest() {
@Test
public void multiplyTest() {
int a = 2, b = 2;
assert calculator.multilply(a, b)==(a*b);
assert calculator.multiply(a, b)==(a*b);
}

@Test
public void sumTestDouble() {
double a = 2, b = 2;
assert calculator.sum(a, b)==(a+b);
}

@Test
public void subtractTestDouble() {
double a = 2, b = 2;
assert calculator.subtract(a, b)==(a-b);
}

@Test
public void divideTestDouble() {
double a = 2, b = 3;
assert calculator.divide(a, b)==(((double)a)/b);
}

@Test
public void multiplyTestDouble() {
double a = 2, b = 2;
assert calculator.multiply(a, b)==(a*b);
}

}

0 comments on commit 1c7c14c

Please sign in to comment.