summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-07-17 12:04:07 +0200
committerGitHub <noreply@github.com>2020-07-17 12:04:07 +0200
commit1c69b4e72b3212e3ce989a8675db08ac51b7f79d (patch)
tree3714c4ea91a3e68826e5ddbb73f71daa93105aec /vespajlib/src/test
parent174910488e7793d9962775c0325764ed265ea2ce (diff)
Revert "Load platform bundles separately 3"
Diffstat (limited to 'vespajlib/src/test')
-rw-r--r--vespajlib/src/test/java/com/yahoo/collections/PredicateSplitTestCase.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/collections/PredicateSplitTestCase.java b/vespajlib/src/test/java/com/yahoo/collections/PredicateSplitTestCase.java
new file mode 100644
index 00000000000..05a719d6a4d
--- /dev/null
+++ b/vespajlib/src/test/java/com/yahoo/collections/PredicateSplitTestCase.java
@@ -0,0 +1,30 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.collections;
+
+import org.junit.Test;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+
+public class PredicateSplitTestCase {
+ @Test
+ public void requireThatSplitWorks() {
+ List<Integer> l = new ArrayList<Integer>();
+ l.add(1);
+ l.add(6);
+ l.add(2);
+ l.add(4);
+ l.add(5);
+ PredicateSplit<Integer> result = PredicateSplit.partition(l, x -> (x % 2 == 0));
+ assertEquals((long) result.falseValues.size(), 2L);
+ assertEquals((long) result.falseValues.get(0), 1L);
+ assertEquals((long) result.falseValues.get(1), 5L);
+
+ assertEquals((long) result.trueValues.size(), 3L);
+ assertEquals((long) result.trueValues.get(0), 6L);
+ assertEquals((long) result.trueValues.get(1), 2L);
+ assertEquals((long) result.trueValues.get(2), 4L);
+ }
+}