Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit 7f769f8b authored by Noric Couderc's avatar Noric Couderc

Added test to check reset() of apps.

Checks an apps that has been reseted still works.
parent eedc60df
......@@ -382,6 +382,31 @@ public class ApplicationTest {
Assert.assertEquals(s, app.runSize());
Assert.assertTrue(expected.getDataStructure().containsValue(e));
@Test
public void testReset() throws InvocationTargetException, IllegalAccessException {
ListApplication app = new ListApplication(0, 100, 10, new ArrayList<>());
List<Integer> vals1 = new ArrayList<>();
while (app.hasNext()) {
Object value = app.invokeCurrentMethod();
vals1.add(value instanceof Integer ? (Integer) value : 0);
app.tick();
}
List result1 = app.getDataStructure();
app.reset(app.getBaseDataStructureSize());
List<Object> vals2 = new ArrayList<>();
while (app.hasNext()) {
Object value = app.invokeCurrentMethod();
vals2.add(value instanceof Integer ? (Integer) value : 0);
app.tick();
}
List result2 = app.getDataStructure();
Assert.assertEquals(vals1, vals2);
Assert.assertEquals(result1, result2);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment