/* * The test class BinOpTest. * Only check `equals` and `hashCode`; * testing of higher-level functions all in `class ExprTest`. * * @author ibarland@radford.edu * @license CC0; please just site URL, e.g. http://www.radford.edu/itec380/2018fall-ibarland/Homeworks/Project/T0-java/ * @version 2018.Nov.16 */ import static org.junit.Assert.*; import org.junit.Test; public class BinOpTest { @Test public void equalsTest() { BinOp e1 = new BinOp(new Num(4), "boii", new Num(5) ); BinOp e2 = new BinOp(new Num(4), "boii", new Num(5) ); BinOp e3 = new BinOp(new Num(5), "boii", new Num(4) ); 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() ); } }