Skip to content

Commit fa2ef16

Browse files
committed
code cleanup
1 parent 9943828 commit fa2ef16

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

core/src/test/java/io/questdb/test/std/DirectLongHashSetTest.java

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import io.questdb.std.DirectLongHashSet;
2828
import io.questdb.std.Rnd;
29+
import io.questdb.std.str.StringSink;
2930
import org.junit.Assert;
3031
import org.junit.Test;
3132

@@ -42,7 +43,6 @@ public void testAddAndContains() {
4243
Assert.assertTrue(set.contains(200));
4344
Assert.assertTrue(set.contains(300));
4445
Assert.assertFalse(set.contains(400));
45-
4646
Assert.assertEquals(3, set.size());
4747
}
4848
}
@@ -51,7 +51,7 @@ public void testAddAndContains() {
5151
public void testAddDuplicate() {
5252
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
5353
Assert.assertTrue(set.add(100));
54-
Assert.assertFalse(set.add(100)); // Duplicate
54+
Assert.assertFalse(set.add(100));
5555
Assert.assertEquals(1, set.size());
5656
}
5757
}
@@ -61,7 +61,7 @@ public void testAddZero() {
6161
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
6262
Assert.assertTrue(set.add(0));
6363
Assert.assertTrue(set.contains(0));
64-
Assert.assertFalse(set.add(0)); // Duplicate
64+
Assert.assertFalse(set.add(0));
6565
Assert.assertEquals(1, set.size());
6666
}
6767
}
@@ -117,19 +117,9 @@ public void testExcludes() {
117117
}
118118
}
119119

120-
@Test
121-
public void testKeyIndex() {
122-
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
123-
set.add(100);
124-
Assert.assertTrue(set.keyIndex(100) < 0); // Exists
125-
Assert.assertTrue(set.keyIndex(200) >= 0); // Doesn't exist
126-
}
127-
}
128-
129120
@Test
130121
public void testMixedPositiveAndNegativeValues() {
131122
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
132-
// Test with mixed positive and negative values
133123
Assert.assertTrue(set.add(1));
134124
Assert.assertTrue(set.add(2));
135125
Assert.assertTrue(set.add(3));
@@ -226,15 +216,6 @@ public void testSentinelValues() {
226216
}
227217
}
228218

229-
@Test
230-
public void testToSinkEmpty() {
231-
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
232-
io.questdb.std.str.StringSink sink = new io.questdb.std.str.StringSink();
233-
set.toSink(sink);
234-
Assert.assertEquals("[]", sink.toString());
235-
}
236-
}
237-
238219
@Test
239220
public void testToSinkWithNegativeValues() {
240221
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
@@ -256,8 +237,7 @@ public void testToSinkWithValues() {
256237
set.add(3);
257238
set.add(1);
258239
set.add(2);
259-
260-
io.questdb.std.str.StringSink sink = new io.questdb.std.str.StringSink();
240+
StringSink sink = new StringSink();
261241
set.toSink(sink);
262242
Assert.assertEquals("[1,2,3]", sink.toString());
263243
}
@@ -271,24 +251,12 @@ public void testToSinkWithZero() {
271251
set.add(5);
272252
set.add(-5);
273253

274-
io.questdb.std.str.StringSink sink = new io.questdb.std.str.StringSink();
254+
StringSink sink = new StringSink();
275255
set.toSink(sink);
276256
Assert.assertEquals("[-5,0,5,10]", sink.toString());
277257
}
278258
}
279259

280-
@Test
281-
public void testToString() {
282-
try (DirectLongHashSet set = new DirectLongHashSet(16)) {
283-
set.add(100);
284-
set.add(50);
285-
set.add(200);
286-
287-
String result = set.toString();
288-
Assert.assertEquals("[50,100,200]", result);
289-
}
290-
}
291-
292260
@Test
293261
public void testZeroWithOtherValues() {
294262
try (DirectLongHashSet set = new DirectLongHashSet(16)) {

0 commit comments

Comments
 (0)