Skip to content

Commit 71b52d1

Browse files
committed
test: cover worklist and deprecate legacy frontends
1 parent 7a7bb43 commit 71b52d1

4 files changed

Lines changed: 49 additions & 3 deletions

File tree

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassAttributes/package-info.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Legacy Jass attribute support.
3+
* @deprecated This internal compatibility package is planned for removal.
4+
*/
15
@org.eclipse.jdt.annotation.NonNullByDefault
6+
@Deprecated
27
package de.peeeq.wurstscript.frotty.jassAttributes;
3-

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassValidator/package-info.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Legacy Jass validation support.
3+
* @deprecated This internal compatibility package is planned for removal.
4+
*/
15
@org.eclipse.jdt.annotation.NonNullByDefault
6+
@Deprecated
27
package de.peeeq.wurstscript.frotty.jassValidator;
3-

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jurst/package-info.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Legacy Jurst compatibility frontend. Prefer Wurst source for new code.
3+
* @deprecated Jurst is retained only for compatibility and is planned for removal.
4+
*/
15
@org.eclipse.jdt.annotation.NonNullByDefault
6+
@Deprecated
27
package de.peeeq.wurstscript.jurst;
3-
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package tests.wurstscript.tests;
2+
3+
import de.peeeq.datastructures.Worklist;
4+
import org.testng.Assert;
5+
import org.testng.annotations.Test;
6+
7+
import java.util.List;
8+
9+
public class WorklistTests {
10+
11+
@Test
12+
public void deduplicatesPendingItemsAndAllowsRequeueAfterPolling() {
13+
Worklist<Integer> worklist = new Worklist<>(List.of(1, 2, 1));
14+
Assert.assertEquals(worklist.size(), 2);
15+
Assert.assertFalse(worklist.isEmpty());
16+
Assert.assertEquals(worklist.poll().intValue(), 1);
17+
worklist.add(2); // still pending, must not be duplicated
18+
worklist.add(3);
19+
Assert.assertEquals(worklist.poll().intValue(), 2);
20+
worklist.add(1); // already consumed, so requeueing is valid
21+
Assert.assertEquals(worklist.poll().intValue(), 3);
22+
Assert.assertEquals(worklist.poll().intValue(), 1);
23+
Assert.assertTrue(worklist.isEmpty());
24+
}
25+
26+
@Test
27+
public void addAllMaintainsFifoOrder() {
28+
Worklist<String> worklist = new Worklist<>();
29+
worklist.addAll(List.of("a", "b", "a"));
30+
Assert.assertEquals(worklist.poll(), "a");
31+
Assert.assertEquals(worklist.poll(), "b");
32+
Assert.assertTrue(worklist.isEmpty());
33+
}
34+
}

0 commit comments

Comments
 (0)