Created
January 20, 2014 02:23
-
-
Save tnhansel/8513918 to your computer and use it in GitHub Desktop.
Chess TestCases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by hanseltan on 1/19/14. | |
*/ | |
public class TestCase { | |
int rowBegin; | |
int colBegin; | |
int rowEnd; | |
int colEnd; | |
boolean correctResult; | |
boolean actualResult; | |
public TestCase() { | |
} | |
public TestCase(int rowBegin,int colBegin, int rowEnd, int colEnd, boolean corectResult) { | |
this.rowBegin = rowBegin; | |
this.correctResult = corectResult; | |
this.colEnd = colEnd; | |
this.rowEnd = rowEnd; | |
this.colBegin = colBegin; | |
} | |
public int getRowBegin() { | |
return rowBegin; | |
} | |
public void setRowBegin(int rowBegin) { | |
this.rowBegin = rowBegin; | |
} | |
public int getColBegin() { | |
return colBegin; | |
} | |
public void setColBegin(int colBegin) { | |
this.colBegin = colBegin; | |
} | |
public int getRowEnd() { | |
return rowEnd; | |
} | |
public void setRowEnd(int rowEnd) { | |
this.rowEnd = rowEnd; | |
} | |
public int getColEnd() { | |
return colEnd; | |
} | |
public void setColEnd(int colEnd) { | |
this.colEnd = colEnd; | |
} | |
public boolean getCorrectResult() { | |
return correctResult; | |
} | |
public void setCorrectResult(boolean correctResult) { | |
this.correctResult = correctResult; | |
} | |
public boolean getActualResult() { | |
return actualResult; | |
} | |
public void setActualResult(boolean actualResult) { | |
this.actualResult = actualResult; | |
} | |
public boolean testKnightCheck(Object SetActualResult){ | |
setActualResult(knightCheck(rowBegin,colBegin,rowEnd,colEnd)); | |
if (correctResult==actualResult){ | |
return true; | |
}else{ | |
return false; | |
} | |
} | |
public static void main(String[] args) { | |
TestCase[] testCases = { | |
new TestCase(1, 1, 1, 1, false), | |
new TestCase(3,4,7,9, false), | |
new TestCase(3,2,4,3,false), | |
new TestCase(1,1,3,2,true), | |
new TestCase(7,3,8,3,true), | |
new TestCase(3,7,1,8,true), | |
}; | |
for (TestCase testCase : testCases) { | |
System.out.println("Row Begin: "+testCase.getRowBegin()); | |
System.out.println("Colomn Begin"+testCase.getColBegin()); | |
System.out.println("Row End"+testCase.getRowEnd()); | |
System.out.println("Colomn End"+testCase.getColEnd()); | |
System.out.println("Correct Result"+testCase.getCorrectResult()); | |
System.out.println("Actual Result"+testCase.getActualResult()); | |
if(testCase.testKnightCheck(null)){ | |
System.out.println("Test PASS"); | |
}else{ | |
System.out.println("Test FAIL"); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment