mschmidt00 commented on a change in pull request #1553:
URL: https://github.com/apache/tinkerpop/pull/1553#discussion_r793247133
##########
File path:
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/CompareTest.java
##########
@@ -95,7 +87,96 @@
{Compare.gte, new B(), new C(), true},
{Compare.lte, new B(), new D(), true},
{Compare.lte, new C(), new C(), true},
- {Compare.lte, new D(), new D(), true}
+ {Compare.lte, new D(), new D(), true},
+
+ // type promotion
+ {Compare.eq, 1, 1.0d, true},
+ {Compare.neq, 1, 1.0d, false},
+ {Compare.lt, 1, 1.0d, false},
+ {Compare.lte, 1, 1.0d, true},
+ {Compare.gt, 1, 1.0d, false},
+ {Compare.gte, 1, 1.0d, true},
+
+ // Incomparable types produce ERROR
+ {Compare.gt, 23, "23", GremlinTypeErrorException.class},
+ {Compare.gte, 23, "23", GremlinTypeErrorException.class},
+ {Compare.lt, 23, "23", GremlinTypeErrorException.class},
+ {Compare.lte, 23, "23", GremlinTypeErrorException.class},
+ {Compare.lte, new CompareTest.A(), new CompareTest.B(),
GremlinTypeErrorException.class},
+ {Compare.lte, new CompareTest.B(), new CompareTest.A(),
GremlinTypeErrorException.class},
+ {Compare.lte, new CompareTest.C(), new CompareTest.D(),
GremlinTypeErrorException.class},
+ {Compare.gte, new Object(), new Object(),
GremlinTypeErrorException.class},
+ {Compare.gte, new Object(), new Object(),
GremlinTypeErrorException.class},
+ {Compare.gte, new Object(), new Object(),
GremlinTypeErrorException.class},
+
+ /*
+ * NaN has pretty much the same comparability behavior against
any argument (including itself):
+ * P.eq(NaN, any) = FALSE
+ * P.neq(NaN, any) = TRUE
+ * P.lt/lte/gt/gte(NaN, any) = ERROR -> FALSE
+ */
+ {Compare.eq, NaN, NaN, false},
Review comment:
ack, having a look now
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]