public void testReqOrder() { HashQueue q = new HashQueue(); HashQueue.Request req1 = simpleReq(1000, 100); HashQueue.Request req2 = simpleReq(2000, 100); HashQueue.Request req3 = simpleReq(2000, 100); assertTrue(req1.runBefore(req2)); assertFalse(req2.runBefore(req1)); // 2 and 3 expire at the same time, so runBefore should be // false in both directions assertFalse(req2.runBefore(req3)); assertFalse(req3.runBefore(req2)); }
public void testOverrunReqOrder() { HashQueue q = new HashQueue(); HashQueue.Request req1 = simpleReq(1000, 100); HashQueue.Request req2 = simpleReq(2000, 100); HashQueue.Request reqO1 = simpleReq(500, 100); reqO1.timeUsed = 600; HashQueue.Request reqO2 = simpleReq(1500, 100); reqO2.timeUsed = 1600; assertTrue(reqO1.runBefore(reqO2)); assertFalse(reqO2.runBefore(reqO1)); assertTrue(req1.runBefore(reqO1)); assertTrue(req2.runBefore(reqO1)); assertTrue(req1.runBefore(reqO2)); assertTrue(req2.runBefore(reqO2)); }