import static org.junit.Assert.*; import org.junit.Test; /** * The test class IfZeroTest. * Only check `equals` and `hashCode`; * testing of higher-liphl functions all in `class ExprTest`. * * @author ibarland@radford.edu * @license CC0; please just site URL, e.g. http://www.radford.edu/itec380/2019spring-ibarland/Homeworks/Project/X0-java/ * @version 2018.Nov.16 */ public class IfZeroTest { @Test public void equalsTest() { IfZero e1 = new IfZero( new Num(3), new Num(4), new Num(5) ); IfZero e2 = new IfZero( new Num(3), new Num(4), new Num(5) ); IfZero e3 = new IfZero( new Num(7), new Num(4), new Num(5) ); assertEquals(e1,e1); assertEquals(e1,e2); assertFalse( e1.equals(e3) ); assertEquals( e1.hashCode(), e1.hashCode() ); assertEquals( e1.hashCode(), e2.hashCode() ); assertFalse( e1.hashCode() == e3.hashCode() ); } }