1 
   2 public class FloatCmpTests {
   3 
   4     private static boolean test_isEq(float a, float b) {
   5         return a == b;
   6     }
   7 
   8     private static boolean test_isNe(float a, float b) {
   9         return a != b;
  10     }
  11 
  12     private static boolean test_isLt(float a, float b) {
  13         return a < b;
  14     }
  15 
  16     private static boolean test_isLe(float a, float b) {
  17         return a <= b;
  18     }
  19 
  20     private static boolean test_isGe(float a, float b) {
  21         return a >= b;
  22     }
  23 
  24     private static boolean test_isGt(float a, float b) {
  25         return a > b;
  26     }
  27 
  28     private static boolean test_isEqC(float a) {
  29         return a == 7F;
  30     }
  31 
  32     private static boolean test_isNeC(float a) {
  33         return a != 7F;
  34     }
  35 
  36     private static boolean test_isLtC(float a) {
  37         return a < 7F;
  38     }
  39 
  40     private static boolean test_isLeC(float a) {
  41         return a <= 7F;
  42     }
  43 
  44     private static boolean test_isGeC(float a) {
  45         return a >= 7F;
  46     }
  47 
  48     private static boolean test_isGtC(float a) {
  49         return a > 7F;
  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(7F, 7F));
  60         assertThat(! test_isEq(70F, 7F));
  61         assertThat(! test_isNe(7F, 7F));
  62         assertThat(test_isNe(70F, 7F));
  63 
  64         assertThat(test_isLt(7F, 70F));
  65         assertThat(! test_isLt(70F, 7F));
  66         assertThat(! test_isLt(7F, 7F));
  67 
  68         assertThat(test_isLe(7F, 70F));
  69         assertThat(! test_isLe(70F, 7F));
  70         assertThat(test_isLe(7F, 7F));
  71 
  72         assertThat(!test_isGe(7F, 70F));
  73         assertThat(test_isGe(70F, 7F));
  74         assertThat(test_isGe(7F, 7F));
  75 
  76         assertThat(!test_isGt(7F, 70F));
  77         assertThat(test_isGt(70F, 7F));
  78         assertThat(! test_isGt(7F, 7F));
  79 
  80 
  81         assertThat(test_isEqC(7F));
  82         assertThat(! test_isEqC(70F));
  83         assertThat(! test_isNeC(7F));
  84         assertThat(test_isNeC(70F));
  85 
  86         assertThat(test_isLtC(6F));
  87         assertThat(! test_isLtC(70F));
  88         assertThat(! test_isLtC(7F));
  89 
  90         assertThat(test_isLeC(6F));
  91         assertThat(! test_isLeC(70F));
  92         assertThat(test_isLeC(7F));
  93 
  94         assertThat(!test_isGeC(6F));
  95         assertThat(test_isGeC(70F));
  96         assertThat(test_isGeC(7F));
  97 
  98         assertThat(!test_isGtC(6F));
  99         assertThat(test_isGtC(70F));
 100         assertThat(! test_isGtC(7F));
 101     }
 102 }