You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LIFORevQueueTest.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2009, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.revwalk;
  11. import static org.junit.Assert.assertEquals;
  12. import static org.junit.Assert.assertNull;
  13. import static org.junit.Assert.assertSame;
  14. import java.util.ArrayList;
  15. import java.util.Collections;
  16. import org.junit.Test;
  17. public class LIFORevQueueTest extends RevQueueTestCase<LIFORevQueue> {
  18. @Override
  19. protected LIFORevQueue create() {
  20. return new LIFORevQueue();
  21. }
  22. @Override
  23. @Test
  24. public void testEmpty() throws Exception {
  25. super.testEmpty();
  26. assertEquals(0, q.outputType());
  27. }
  28. @Test
  29. public void testCloneEmpty() throws Exception {
  30. q = new LIFORevQueue(AbstractRevQueue.EMPTY_QUEUE);
  31. assertNull(q.next());
  32. }
  33. @Test
  34. public void testAddLargeBlocks() throws Exception {
  35. final ArrayList<RevCommit> lst = new ArrayList<>();
  36. for (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) {
  37. final RevCommit c = commit();
  38. lst.add(c);
  39. q.add(c);
  40. }
  41. Collections.reverse(lst);
  42. for (int i = 0; i < lst.size(); i++)
  43. assertSame(lst.get(i), q.next());
  44. }
  45. }