forked from hummel/PR1-Spreadsheet
83 lines
3.0 KiB
Java
83 lines
3.0 KiB
Java
|
package de.hs_mannheim.informatik.spreadsheet;
|
||
|
|
||
|
import static org.junit.jupiter.api.Assertions.*;
|
||
|
|
||
|
class AxelTest {
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("User command or position input")
|
||
|
void userCommandPositionComputation() {
|
||
|
}
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("Command input error check")
|
||
|
void userCommandErrorCheck() {
|
||
|
String[] successTestList = {"*exit", "*save", "*load", "*help", "*eXiT", "*SAVE", "*LoAd", "*hElP"};
|
||
|
String[] failureTestList = {"exit", "save", "load", "help", "eXiT", "SAVE", "LoAd", "hElP", "*exit*", "*save*", "*load*", "*help*", "*eXiT*", "*SAVE*", "*LoAd*", "*hElP*", "*test", "*TEST", "*saev", "*xeit"};
|
||
|
|
||
|
for (String successTest : successTestList) {
|
||
|
assertTrue(Axel.userCommandErrorCheck(successTest));
|
||
|
}
|
||
|
|
||
|
for (String failureTest : failureTestList) {
|
||
|
assertFalse(Axel.userCommandErrorCheck(failureTest));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("Position input error check")
|
||
|
void userPositionErrorCheck() {
|
||
|
//? Overall format test
|
||
|
String[] successTestList = {"A1", "B14", "C79", "E99", "F1", "G99", "J1", "M98", "N67", "o45", "p23", "q12", "r2"};
|
||
|
String[] failureTestList = {"A100", "Z101", "AA1", "AB2", "ZZ1", "A1A", "FHT", "AAA", "G3U", "ZZZ", "2A", "47H", "AAAA", "test", "TEST", "save", "*save", "*exit"};
|
||
|
|
||
|
for (String successTest : successTestList) {
|
||
|
assertTrue(Axel.userPositionErrorCheck(successTest));
|
||
|
}
|
||
|
|
||
|
for (String failureTest : failureTestList) {
|
||
|
assertFalse(Axel.userPositionErrorCheck(failureTest));
|
||
|
}
|
||
|
|
||
|
//? Out of bounds test
|
||
|
Spreadsheet testSpr = new Spreadsheet(6,8);
|
||
|
|
||
|
String[] successBoundsTest = {"A1", "a1", "b3", "c5", "A3", "H6", "h6"};
|
||
|
String[] failureBoundsTest = {"i2", "J6", "B7", "K9", "Z99"};
|
||
|
|
||
|
for (String successTest : successBoundsTest) {
|
||
|
assertTrue(Axel.userPositionBoundsErrorCheck(successTest, testSpr));
|
||
|
}
|
||
|
|
||
|
for (String failureTest : failureBoundsTest) {
|
||
|
assertFalse(Axel.userPositionBoundsErrorCheck(failureTest, testSpr));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("User value or formula input")
|
||
|
void userValueFormulaComputation() {
|
||
|
}
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("Value input error check")
|
||
|
void userValueErrorCheck() {
|
||
|
String[] successTestList = {"0", "1", "-1", "1234", "4324", "-465"};
|
||
|
String[] failureTestList = {"a", "aa", "A!", "A1", "wef", "-a", "a-","-1a"};
|
||
|
|
||
|
for (String successTest : successTestList) {
|
||
|
assertTrue(Axel.userValueErrorCheck(successTest));
|
||
|
}
|
||
|
|
||
|
for (String failureTest : failureTestList) {
|
||
|
assertFalse(Axel.userValueErrorCheck(failureTest));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@org.junit.jupiter.api.Test
|
||
|
@org.junit.jupiter.api.DisplayName("Formula input error check")
|
||
|
void userFormulaErrorCheck() {
|
||
|
}
|
||
|
}
|