Skip to content
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
14 changes: 7 additions & 7 deletions .github/workflows/coverage-prs-all-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ name: Coverage PRs - ALL components

on:
# NOTE: don't activate this by default because it could conflict with the other job ('only changed components')
# pull_request:
# branches:
# - master
# paths:
# - 'calculator-1/src/**'
# - 'calculator-2/src/**'
# - 'calculator-3/src/**'
pull_request:
branches:
- master
paths:
- 'calculator-1/src/**'
- 'calculator-2/src/**'
- 'calculator-3/src/**'


jobs:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/coverage-prs-only-changed-components.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Coverage PRs - only changed components

on:
pull_request:
branches:
- master
paths:
- 'calculator-1/src/**'
- 'calculator-2/src/**'
- 'calculator-3/src/**'
# NOTE: disabled only in this branch/PR to be able to exercise the "ALL components" workflow.
# pull_request:
# branches:
# - master
# paths:
# - 'calculator-1/src/**'
# - 'calculator-2/src/**'
# - 'calculator-3/src/**'


jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public double calculate(double firstOperand, double secondOperand, char operator
case ':':{
return divide(firstOperand,secondOperand);
}
case '^':{
return square(firstOperand);
}
default:
throw new IllegalArgumentException("Unsupported operation :"+operator);
}
Expand All @@ -37,4 +40,7 @@ private double subtract(double firstOperand, double secondOperand) {
private double add(double firstOperand, double secondOperand) {
return firstOperand + secondOperand;
}
private double square(double x) {
return x * x;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ void divideSimple(){
double result = calculator.calculate(1,1,':');
Assertions.assertEquals(1,result);
}

@Test
void squareSimple(){
// the signature isn't flexible so we repeat the same number twice
double result = calculator.calculate(10, 10, '^');
Assertions.assertEquals(100.0,result);
}
}
Loading