Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. @Test
  2. public void TestRemove(){
  3. StudentLinkedListDeque<Integer> testList = new StudentLinkedListDeque<Integer>();
  4. LinkedListDequeSolution<Integer> realList = new LinkedListDequeSolution<Integer>();
  5.  
  6. for(int i = 0; i<100; i++){
  7. if (i%3 == 0|| i%7==0){
  8. testList.addFirst(i);
  9. realList.addFirst(i);
  10. DequeOperation op = new DequeOperation("addFirst", i);
  11. fail.addOperation(op);
  12.  
  13. }
  14. else if (i%13 == 0 || i%5==0){
  15. int a = testList.removeLast();
  16. int b = realList.removeLast();
  17. DequeOperation op = new DequeOperation("removeLast");
  18. fail.addOperation(op);
  19. assertEquals(fail.toString(), b, a);
  20. }else{
  21. testList.addLast(i);
  22. realList.addLast(i);
  23. DequeOperation op = new DequeOperation("addLast", i);
  24. fail.addOperation(op);
  25.  
  26. }
  27.  
  28. }
  29.  
  30. for(int i = 0; i<realList.size() - 1; i++){
  31. DequeOperation op = new DequeOperation("get", i);
  32. fail.addOperation(op);
  33. assertEquals(fail.toString(), realList.get(i), testList.get(i));
  34. }
  35.  
  36.  
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement