This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch v4-io-test in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 7adc9d296fe6dd6141b8ce3431e3d610f6f5af99 Author: Ken Hu <[email protected]> AuthorDate: Fri Aug 2 10:03:28 2024 -0700 added back some enums --- .../gremlin/structure/graphbinary/id-t-v4.gbin | Bin 0 -> 10 bytes .../structure/graphbinary/neg-zero-double-v4.gbin | Bin 0 -> 10 bytes .../structure/graphbinary/neg-zero-float-v4.gbin | Bin 0 -> 6 bytes .../structure/graphbinary/out-direction-v4.gbin | Bin 0 -> 11 bytes .../io/AbstractTypedCompatibilityTest.java | 51 +++++++++++++++++++++ .../tinkerpop/gremlin/structure/io/Model.java | 5 ++ 6 files changed, 56 insertions(+) diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/id-t-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/id-t-v4.gbin new file mode 100644 index 0000000000..8a9235d39d Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/id-t-v4.gbin differ diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-double-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-double-v4.gbin new file mode 100644 index 0000000000..f76a022bab Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-double-v4.gbin differ diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-float-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-float-v4.gbin new file mode 100644 index 0000000000..cfd00ec653 Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/neg-zero-float-v4.gbin differ diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/out-direction-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/out-direction-v4.gbin new file mode 100644 index 0000000000..3caaba3c97 Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/graphbinary/out-direction-v4.gbin differ diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java index e881776185..027d63823f 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java @@ -288,6 +288,19 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertEquals(resource, recycled); } + @Test + public void shouldReadWriteNegativeZeroDouble() throws Exception { + final String resourceName = "neg-zero-double"; + + final Double resource = findModelEntryObject(resourceName); + final Double fromStatic = read(readFromResource(resourceName), Double.class); + final Double recycled = read(write(fromStatic, Double.class, resourceName), Double.class); + assertNotSame(fromStatic, recycled); + assertEquals(fromStatic, recycled); + assertEquals(resource, fromStatic); + assertEquals(resource, recycled); + } + @Test public void shouldReadWriteZeroDuration() throws Exception { final String resourceName = "zero-duration"; @@ -434,6 +447,19 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertEquals(resource, recycled); } + @Test + public void shouldReadWriteNegativeZeroFloat() throws Exception { + final String resourceName = "neg-zero-float"; + + final Float resource = findModelEntryObject(resourceName); + final Float fromStatic = read(readFromResource(resourceName), Float.class); + final Float recycled = read(write(fromStatic, Float.class, resourceName), Float.class); + assertNotSame(fromStatic, recycled); + assertEquals(fromStatic, recycled); + assertEquals(resource, fromStatic); + assertEquals(resource, recycled); + } + @Test public void shouldReadWriteMaxInteger() throws Exception { final String resourceName = "max-int"; @@ -828,4 +854,29 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertVertexProperty(resource, recycled); assertVertexProperty(resource, fromStatic); } + + @Test + public void shouldReadWriteIdT() throws Exception { + final String resourceName = "id-t"; + + final T resource = findModelEntryObject(resourceName); + final T fromStatic = read(readFromResource(resourceName), T.class); + final T recycled = read(write(fromStatic, T.class, resourceName), T.class); + assertEquals(fromStatic, recycled); + assertEquals(resource, fromStatic); + assertEquals(resource, recycled); + } + + @Test + public void shouldReadWriteOutDirection() throws Exception { + final String resourceName = "out-direction"; + + final Direction resource = findModelEntryObject(resourceName); + final Direction fromStatic = read(readFromResource(resourceName), Direction.class); + final Direction recycled = read(write(fromStatic, Direction.class, resourceName), Direction.class); + assertEquals(fromStatic, recycled); + assertEquals(resource, fromStatic); + assertEquals(resource, recycled); + } + } diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java index e2e1ee646d..7c2b081f9a 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java @@ -119,6 +119,7 @@ public class Model { addCoreEntry(Double.NaN, "nan-double"); addCoreEntry(Double.POSITIVE_INFINITY, "pos-inf-double"); addCoreEntry(Double.NEGATIVE_INFINITY, "neg-inf-double"); + addCoreEntry(-0.0, "neg-zero-double"); addCoreEntry(Float.MAX_VALUE, "max-float"); addCoreEntry(Float.MIN_VALUE, "min-float"); @@ -127,6 +128,7 @@ public class Model { addCoreEntry(Float.NaN, "nan-float"); addCoreEntry(Float.POSITIVE_INFINITY, "pos-inf-float"); addCoreEntry(Float.NEGATIVE_INFINITY, "neg-inf-float"); + addCoreEntry(-0.0f, "neg-zero-float"); addCoreEntry(Integer.MAX_VALUE, "max-int"); addCoreEntry(Integer.MIN_VALUE, "min-int"); @@ -205,6 +207,9 @@ public class Model { addExtendedEntry(Short.MIN_VALUE, "min-short", ""); addExtendedEntry(Short.MAX_VALUE, "max-short", ""); + + addGraphProcessEntry(Direction.OUT, "out-direction", ""); + addGraphProcessEntry(T.id, "id-t", ""); } public static Model instance() {
