You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/04/17 16:09:14 UTC
[tinkerpop] branch master updated: Added a test around calling
steps with varargs that use arrays CTR
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 82254f1 Added a test around calling steps with varargs that use arrays CTR
new e9e2599 Merge branch 'tp33'
82254f1 is described below
commit 82254f1dbf6660f542f1c51bd450a10a8455b2a5
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Apr 17 12:07:26 2019 -0400
Added a test around calling steps with varargs that use arrays CTR
---
.../gremlin/process/traversal/BytecodeTest.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
index 6f47762..2a961bb 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
@@ -146,26 +146,34 @@ public class BytecodeTest {
}
@Test
- public void bindingShouldNotHaveHashCollisions() {
+ public void shouldNotHaveHashCollisionsWithBindings() {
// ideally we should be using guava's EqualsTester to test equals/hashCode but the equals/hashCode contract allows hash collisions.
// Yet we should avoid hash collisions in case these objects are being used in data structures that rely on hashCode
- Bytecode.Binding<String> first = new Bytecode.Binding<>("3", "7");
- Bytecode.Binding<String> second = new Bytecode.Binding<>("7", "3");
+ final Bytecode.Binding<String> first = new Bytecode.Binding<>("3", "7");
+ final Bytecode.Binding<String> second = new Bytecode.Binding<>("7", "3");
assertNotEquals(first, second);
assertNotEquals(first.hashCode(), second.hashCode());
}
@Test
- public void bytecodeShouldNotHaveHashCollisions() {
+ public void shouldNotHaveHashCollisions() {
// ideally we should be using guava's EqualsTester to test equals/hashCode but the equals/hashCode contract allows hash collisions.
// Yet we should avoid hash collisions in case these objects are being used in data structures that rely on hashCode
- Bytecode first = new Bytecode();
+ final Bytecode first = new Bytecode();
first.addSource("3", "7");
first.addStep("7", "3");
- Bytecode second = new Bytecode();
+ final Bytecode second = new Bytecode();
second.addSource("7", "3");
second.addStep("3", "7");
assertNotEquals(first, second);
assertNotEquals(first.hashCode(), second.hashCode());
}
+
+ @Test
+ public void shouldHandleArrays() {
+ final Bytecode b = new Bytecode();
+ b.addStep(GraphTraversal.Symbols.property, "k", new Object[] { new String[] {"A", "B", "C"}});
+ assertEquals(1, b.getStepInstructions().size());
+ assertEquals(2, b.getStepInstructions().get(0).getArguments().length);
+ }
}