Skip to content

Commit

Permalink
Finish all the test
Browse files Browse the repository at this point in the history
  • Loading branch information
YangZhou91 committed Feb 24, 2014
1 parent fa8ad94 commit 7e08e66
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 7 deletions.
Binary file modified TriangleDetector/bin/TriangleDetector.apk
Binary file not shown.
Binary file modified TriangleDetector/bin/classes.dex
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ else if (!validateInputRange(valueA,valueB,valueC)){
else if (validateEquilateralTriangle(valueA,valueB,valueC)){
output.setText("Equilateral Triangle");
}
else if (validateScaleneTrangle(valueA,valueB,valueC)){
else if (validateScaleneTrangle(valueA,valueB,valueC) &&!validateNotTriangle(valueA, valueB, valueC)){
output.setText("Scalene Triangle");
}
else if (validateIsoscelesTriangle(valueA,valueB,valueC)){
output.setText("Isoscalene Triangle");
}
else if (validateNotTriangle(valueA,valueB,valueC)){
output.setText("It is not a Triangle");
}
}
});
}
Expand Down Expand Up @@ -147,10 +153,10 @@ public boolean validateNotTriangle(String inputA, String inputB, String inputC)
int lengthC = Integer.parseInt(inputC);

if ((lengthA+lengthB > lengthC) && (lengthA+lengthC > lengthB) && (lengthC+lengthB > lengthA)){
return true;
return false;
}
else {
return false;
return true;
}
}

Expand Down
Binary file modified TriangleDetectorTests/bin/TriangleDetectorTests.apk
Binary file not shown.
Binary file modified TriangleDetectorTests/bin/classes.dex
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public void testNotTriangle(){
final String inputA = "50";
final String inputB = "20";
final String inputC = "40";
// The expected result returns true if sum of any two lengths are greater than the other
final boolean expected = true;
// The expected result returns false if it is a triangle
final boolean expected = false;
boolean actual = mFirstTestActivity.validateNotTriangle(inputA, inputB, inputC);
assertEquals(expected, actual);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ public void testIntegrationScelesTriangle(){
String actual = output.getText().toString();
assertEquals(expected, actual);
}
/*

@UiThreadTest
public void testIntegrationIsoscelesTriangle(){
inputA.setText("10");
Expand All @@ -211,5 +211,15 @@ public void testIntegrationIsoscelesTriangle(){
String actual = output.getText().toString();
assertEquals(expected, actual);
}
*/
@UiThreadTest
public void testIntegrationNotTriangle(){
inputA.setText("100");
inputB.setText("10");
inputC.setText("2");
calculateButton.performClick();
final String expected = "It is not a Triangle";
String actual = output.getText().toString();
assertEquals(expected, actual);
}

}

0 comments on commit 7e08e66

Please sign in to comment.