aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/pack/IntSetTest.java
blob: aa59a64159cf3abc4786480d2eb18eec43bc1270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (C) 2011, Google Inc. and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package org.eclipse.jgit.internal.storage.pack;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class IntSetTest {
	@Test
	public void testAdd() {
		IntSet s = new IntSet();

		assertTrue(s.add(1));
		assertFalse(s.add(1));

		for (int i = 2; i < 64; i++)
			assertTrue(s.add(i));
		for (int i = 2; i < 64; i++)
			assertFalse(s.add(i));

		assertTrue(s.add(-1));
		assertFalse(s.add(-1));

		assertTrue(s.add(-2));
		assertFalse(s.add(-2));

		assertTrue(s.add(128));
		assertFalse(s.add(128));

		assertFalse(s.add(1));
	}
}