diff --git a/pom.xml b/pom.xml
index 47d2f7b..9ad12e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,7 +260,18 @@
hamcrest-library
test
-
+
+ com.pholser
+ junit-quickcheck-core
+ 0.9.3
+ test
+
+
+ com.pholser
+ junit-quickcheck-generators
+ 0.9.3
+ test
+
diff --git a/src/test/java/exchange/core2/collections/art/LongAdaptiveRadixTreeMapTest.java b/src/test/java/exchange/core2/collections/art/LongAdaptiveRadixTreeMapTest.java
index a3fc753..a52692c 100644
--- a/src/test/java/exchange/core2/collections/art/LongAdaptiveRadixTreeMapTest.java
+++ b/src/test/java/exchange/core2/collections/art/LongAdaptiveRadixTreeMapTest.java
@@ -654,7 +654,7 @@ private void remove(long key) {
}
- private static void checkStreamsEqual(final Stream> entry, final Stream> origEntry) {
+ public static void checkStreamsEqual(final Stream> entry, final Stream> origEntry) {
final Iterator> iter = entry.iterator();
final Iterator> origIter = origEntry.iterator();
while (iter.hasNext() && origIter.hasNext()) {
diff --git a/src/test/java/exchange/core2/collections/art/testoracle/ManualTestOracle.java b/src/test/java/exchange/core2/collections/art/testoracle/ManualTestOracle.java
new file mode 100644
index 0000000..6a9c781
--- /dev/null
+++ b/src/test/java/exchange/core2/collections/art/testoracle/ManualTestOracle.java
@@ -0,0 +1,41 @@
+package exchange.core2.collections.art.testoracle;
+
+import exchange.core2.collections.art.LongAdaptiveRadixTreeMap;
+import exchange.core2.collections.art.LongAdaptiveRadixTreeMapTest;
+import org.junit.Test;
+
+import java.util.*;
+
+public class ManualTestOracle {
+
+ @Test
+ public void shouldMaintainOrder(){
+ List arrayOfLong = Arrays.asList(-4429196230935817217L, 2967034165565055791L, 3969304394476946051L, 5502623383577302445L);
+// List arrayOfLong = Arrays.asList(1L, 2L, -3L, 4L, 2967034165565055791L, 3969304394476946051L, 5502623383577302445L);
+
+ LongAdaptiveRadixTreeMap testedMap = new LongAdaptiveRadixTreeMap<>();
+ TreeMap oracleMap = new TreeMap<>();
+
+ for (Long key : arrayOfLong) {
+ String value = String.valueOf(key);
+ oracleMap.put(key, value);
+ testedMap.put(key, value);
+ }
+
+ System.out.println("\norig");
+ printEntries(oracleMap.entrySet());
+
+ System.out.println("\ntested");
+ printEntries(testedMap.entriesList());
+
+ System.out.println("\n" + testedMap.printDiagram());
+
+ LongAdaptiveRadixTreeMapTest.checkStreamsEqual(testedMap.entriesList().stream(), oracleMap.entrySet().stream());
+ }
+
+ private void printEntries(Collection> entries) {
+ for (Map.Entry longStringEntry : entries) {
+ System.out.println(longStringEntry.getKey() + ": " + longStringEntry.getValue());
+ }
+ }
+}
diff --git a/src/test/java/exchange/core2/collections/art/testoracle/QuickcheckTestOracle.java b/src/test/java/exchange/core2/collections/art/testoracle/QuickcheckTestOracle.java
new file mode 100644
index 0000000..c54f2e9
--- /dev/null
+++ b/src/test/java/exchange/core2/collections/art/testoracle/QuickcheckTestOracle.java
@@ -0,0 +1,44 @@
+package exchange.core2.collections.art.testoracle;
+
+import com.pholser.junit.quickcheck.Property;
+import com.pholser.junit.quickcheck.generator.InRange;
+import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
+import exchange.core2.collections.art.LongAdaptiveRadixTreeMap;
+import exchange.core2.collections.art.LongAdaptiveRadixTreeMapTest;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+import java.util.TreeMap;
+
+@RunWith(JUnitQuickcheck.class)
+public class QuickcheckTestOracle {
+
+ @Property(trials = 1500)
+ public void shouldEntriesMaintainCorrectOrderMixedSignValues(List arrayOfLong){
+ shouldEntriesMaintainCorrectOrder(arrayOfLong);
+ }
+
+ @Property(trials = 1500)
+ public void shouldEntriesMaintainCorrectOrderAllNegativeValues(List<@InRange(max = "0") Long> arrayOfLong){
+ shouldEntriesMaintainCorrectOrder(arrayOfLong);
+ }
+
+ @Property(trials = 1500)
+ public void shouldEntriesMaintainCorrectOrderAllPositiveValues(List<@InRange(min = "0") Long> arrayOfLong){
+ shouldEntriesMaintainCorrectOrder(arrayOfLong);
+ }
+
+ private void shouldEntriesMaintainCorrectOrder(List arrayOfLong) {
+ LongAdaptiveRadixTreeMap testedMap = new LongAdaptiveRadixTreeMap<>();
+ TreeMap oracleMap = new TreeMap<>();
+
+ for (Long key : arrayOfLong) {
+ String value = String.valueOf(key);
+ oracleMap.put(key, value);
+ testedMap.put(key, value);
+ }
+
+ LongAdaptiveRadixTreeMapTest.checkStreamsEqual(testedMap.entriesList().stream(), oracleMap.entrySet().stream());
+ }
+
+}