1 2 public class IntCmpTests { 3 4 private static boolean test_isEq(int a, int b) { 5 return a == b; 6 } 7 8 private static boolean test_isNe(int a, int b) { 9 return a != b; 10 } 11 12 private static boolean test_isLt(int a, int b) { 13 return a < b; 14 } 15 16 private static boolean test_isLe(int a, int b) { 17 return a <= b; 18 } 19 20 private static boolean test_isGe(int a, int b) { 21 return a >= b; 22 } 23 24 private static boolean test_isGt(int a, int b) { 25 return a > b; 26 } 27 28 private static boolean test_isEqC(int a) { 29 return a == 7; 30 } 31 32 private static boolean test_isNeC(int a) { 33 return a != 7; 34 } 35 36 private static boolean test_isLtC(int a) { 37 return a < 7; 38 } 39 40 private static boolean test_isLeC(int a) { 41 return a <= 7; 42 } 43 44 private static boolean test_isGeC(int a) { 45 return a >= 7; 46 } 47 48 private static boolean test_isGtC(int a) { 49 return a > 7; 50 } 51 52 private static void assertThat(boolean assertion) { 53 if (! assertion) { 54 throw new AssertionError(); 55 } 56 } 57 58 public static void main(String[] args) { 59 assertThat(test_isEq(7, 7)); 60 assertThat(! test_isEq(70, 7)); 61 assertThat(! test_isNe(7, 7)); 62 assertThat(test_isNe(70, 7)); 63 64 assertThat(test_isLt(7, 70)); 65 assertThat(! test_isLt(70, 7)); 66 assertThat(! test_isLt(7, 7)); 67 68 assertThat(test_isLe(7, 70)); 69 assertThat(! test_isLe(70, 7)); 70 assertThat(test_isLe(7, 7)); 71 72 assertThat(!test_isGe(7, 70)); 73 assertThat(test_isGe(70, 7)); 74 assertThat(test_isGe(7, 7)); 75 76 assertThat(!test_isGt(7, 70)); 77 assertThat(test_isGt(70, 7)); 78 assertThat(! test_isGt(7, 7)); 79 80 assertThat(test_isEqC(7)); 81 assertThat(! test_isEqC(70)); 82 assertThat(! test_isNeC(7)); 83 assertThat(test_isNeC(70)); 84 85 assertThat(test_isLtC(6)); 86 assertThat(! test_isLtC(70)); 87 assertThat(! test_isLtC(7)); 88 89 assertThat(test_isLeC(6)); 90 assertThat(! test_isLeC(70)); 91 assertThat(test_isLeC(7)); 92 93 assertThat(!test_isGeC(6)); 94 assertThat(test_isGeC(70)); 95 assertThat(test_isGeC(7)); 96 97 assertThat(!test_isGtC(6)); 98 assertThat(test_isGtC(70)); 99 assertThat(! test_isGtC(7)); 100 101 } 102 }