-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestOffByOne.java
32 lines (30 loc) · 1.07 KB
/
TestOffByOne.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import org.junit.Test;
import static org.junit.Assert.*;
public class TestOffByOne {
// You must use this CharacterComparator and not instantiate
// new ones, or the autograder might be upset.
static CharacterComparator offByOne = new OffByOne();
@Test
public void testOffByOne() {
char one = 'A';
char two = 'a';
char three = 'c';
char four = 'z';
char five = 'B';
char six = ' ';
char seven = 'A';
char eight = '&';
char nine = '%';
char ten = 'b';
assertTrue(offByOne.equalChars(one, five));
assertFalse(offByOne.equalChars(one, two));
assertFalse(offByOne.equalChars(one, three));
assertFalse(offByOne.equalChars(one, four));
assertFalse(offByOne.equalChars(one, six));
assertFalse(offByOne.equalChars(one, seven));
assertTrue(offByOne.equalChars(eight, nine));
assertFalse(offByOne.equalChars(two, five));
assertFalse(offByOne.equalChars(seven, ten));
assertFalse(offByOne.equalChars(five, ten));
}
}