You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2022/01/29 22:04:55 UTC

[GitHub] [tinkerpop] lvca commented on a change in pull request #1552: Fixed issue on comparing BigDecimal with Double/Float infinite numbers

lvca commented on a change in pull request #1552:
URL: https://github.com/apache/tinkerpop/pull/1552#discussion_r795098060



##########
File path: gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/CompareTest.java
##########
@@ -138,6 +138,84 @@
                 {Compare.gte, big2, big1, true},
                 {Compare.lte, big2, big1, false},
         }));
+
+        // Compare bigdecimal numbers with double infinite
+        final BigDecimal big500 = new BigDecimal("500.00");
+
+        final Double doubleInfinite = Double.POSITIVE_INFINITY;
+        testCases.addAll(Arrays.asList(new Object[][]{
+            // big500 - doubleInfinite
+            {Compare.eq, big500, doubleInfinite, false},
+            {Compare.neq, big500, doubleInfinite, true},
+            {Compare.gt, big500, doubleInfinite, false},
+            {Compare.lt, big500, doubleInfinite, true},
+            {Compare.gte, big500, doubleInfinite, false},
+            {Compare.lte, big500, doubleInfinite, true},
+            // doubleInfinite - big500
+            {Compare.eq, doubleInfinite, big500, false},
+            {Compare.neq, doubleInfinite, big500, true},
+            {Compare.gt, doubleInfinite, big500, true},
+            {Compare.lt, doubleInfinite, big500, false},
+            {Compare.gte, doubleInfinite, big500, true},
+            {Compare.lte, doubleInfinite, big500, false},
+        }));
+
+        // Compare bigdecimal numbers with float infinite
+        final Float floatInfinite = Float.POSITIVE_INFINITY;
+        testCases.addAll(Arrays.asList(new Object[][]{
+            // big500 - floatInfinite
+            {Compare.eq, big500, floatInfinite, false},
+            {Compare.neq, big500, floatInfinite, true},
+            {Compare.gt, big500, floatInfinite, false},
+            {Compare.lt, big500, floatInfinite, true},
+            {Compare.gte, big500, floatInfinite, false},
+            {Compare.lte, big500, floatInfinite, true},
+            // floatInfinite - big500
+            {Compare.eq, floatInfinite, big500, false},
+            {Compare.neq, floatInfinite, big500, true},
+            {Compare.gt, floatInfinite, big500, true},
+            {Compare.lt, floatInfinite, big500, false},
+            {Compare.gte, floatInfinite, big500, true},
+            {Compare.lte, floatInfinite, big500, false},
+        }));
+
+        final Double doubleNegativeInfinite = Double.NEGATIVE_INFINITY;
+        testCases.addAll(Arrays.asList(new Object[][]{
+            // big500 - doubleNegativeInfinite
+            {Compare.eq, big500, doubleNegativeInfinite, false},
+            {Compare.neq, big500, doubleNegativeInfinite, true},
+            {Compare.gt, big500, doubleNegativeInfinite, true},
+            {Compare.lt, big500, doubleNegativeInfinite, false},
+            {Compare.gte, big500, doubleNegativeInfinite, true},
+            {Compare.lte, big500, doubleNegativeInfinite, false},
+            // doubleNegativeInfinite - big500
+            {Compare.eq, doubleNegativeInfinite, big500, false},
+            {Compare.neq, doubleNegativeInfinite, big500, true},
+            {Compare.gt, doubleNegativeInfinite, big500, false},
+            {Compare.lt, doubleNegativeInfinite, big500, true},
+            {Compare.gte, doubleNegativeInfinite, big500, false},
+            {Compare.lte, doubleNegativeInfinite, big500, true},
+        }));
+//

Review comment:
       I guess I pushed between some tests. Fixing it




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org