### Question:
Repeat { public static ERE get(ERE child, int num) { if(num < 1) { return Empty.get(); } else if(num == 1) { return child; } else { ERE ret = Concat.get(child, child); for(int i = 2; i < num; ++i) { ret = Concat.get(child, ret); } return ret; } }  static ERE get(ERE child, int num);  }### Answer:
@Test public void equalityTest() { ERE a_x5_again = Repeat.get(a, 5); assertEquals(a_x5, a_x5_again); assertEquals(0, a_x5.compareTo(a_x5_again)); }
@Test public void inequalityTest() { ERE a_x10 = Repeat.get(a, 10); Symbol b = Symbol.get("b"); ERE b_x5 = Repeat.get(b, 5); assertFalse(a_x5.equals(a_x10)); assertFalse(0 == a_x5.compareTo(a_x10)); assertFalse(a_x5.equals(b_x5)); assertFalse(0 == a_x5.compareTo(b_x5)); }
@Test public void deriveTest() { Symbol a = Symbol.get("a"); Epsilon epsilon = Epsilon.get(); assertEquals(epsilon, a_x3.derive(a).derive(a).derive(a)); Empty empty = Empty.get(); assertEquals(empty, a_x3.derive(a).derive(a).derive(a).derive(a)); Symbol b = Symbol.get("b"); assertEquals(empty, a_x3.derive(b)); }